stevew Posted July 30, 2012 Share Posted July 30, 2012 functions.php <?php function copyright(){ echo "July 30, 2012<br />"; } ?> <?php { echo copyright(); } Result: July 30, 2012 How would I call this function from say footer.php? Quote Link to comment Share on other sites More sharing options...
Jessica Posted July 30, 2012 Share Posted July 30, 2012 on that page, require_once('functions.php'); Quote Link to comment Share on other sites More sharing options...
stevew Posted July 30, 2012 Author Share Posted July 30, 2012 Thank you. How do I require it more than "once"? ie once in footer.php and once in header.php? Quote Link to comment Share on other sites More sharing options...
Jessica Posted July 30, 2012 Share Posted July 30, 2012 Don't require it more than once, because then you'll be defining the function more than once. Just call the function in header and footer. also you're being redundant, you call echo copyright() but copyright doesn't return anything, it just echos. This is wrong. Quote Link to comment Share on other sites More sharing options...
stevew Posted July 30, 2012 Author Share Posted July 30, 2012 Got it thanks. Ya, I noticed it seemed redundant () but was only using as an example. Thanks again 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.