andr923 Posted July 3, 2007 Share Posted July 3, 2007 Hey guys, I'm new to this community and am a musician who's been teaching himself some php to use on his site. My question is kind of straightfoward. The way my site will work is that every page will 'include' the template.php with the basic structural elements. What I want to do is create functions in the site pages so that the included file (template.php) can call those functions and input the appropriate content. I.E. my index.php file contains function image() {}. a few lines later in the same index.php file i include my template.php. In the template.php file I want to be able to call on the function "image()". Is that possible? and how do I do it? Thanks a bunch! if curious this is my work in progress: http://www.andreimatorin.com/new Quote Link to comment Share on other sites More sharing options...
per1os Posted July 3, 2007 Share Posted July 3, 2007 Give it a try, it does work. A better solution would be to create a "Functions" file and include that in the template.php file, that way you have one place to modify all functions and only need to include one file, template.php. But yes it would work. Quote Link to comment Share on other sites More sharing options...
andr923 Posted July 3, 2007 Author Share Posted July 3, 2007 sorry i should have mentioned that I did try and it's giving me Fatal error: Call to undefined function: image() in /home/andreima/public_html/new/includes/template.php on line 80 the problem with your suggestion to include a functions file is that I am using these functions to determine the content of each page. I want each page to have the same function names, but their content is actually different. Quote Link to comment Share on other sites More sharing options...
andr923 Posted July 3, 2007 Author Share Posted July 3, 2007 Nevermind, works great! thanks!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.