Kimomaru Posted June 19, 2012 Share Posted June 19, 2012 Hello, I'm working on implementing a very simple web page for my learning of PHP (in preparation for implementing with mySQL). It should be straight forward, but I'm having difficulty understanding how function syntax should work. On my main page, I'm calling a header, footer, and another PHP file; <?php require('header.php'); require_once('site_fns.php'); display_site_info(); require('footer.php');?> The header and footer show up fine up until the site_fns.php syntax, after which everything underneath the header can't be rendered. The site_fns.php file looks like this; <?php require_once('data_valid_fns.php'); require_once('db_fns.php'); require_once('user_auth_fns.php'); require_once('output_fns.php'); ?> The display_site_info() function is in the output_fns.php file, I'm positive that the problem is here; <?php function display_site_info() { ?> <ul> <li>This is test gibberish</li> </ul> } Can someone helpe me understand what I'm doing wrong? I'm very new to this, so any help would be appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/264461-trouble-with-functions-syntax-please-help/ Share on other sites More sharing options...
requinix Posted June 19, 2012 Share Posted June 19, 2012 To close the function you have to go back into PHP code with another <?php. function display_site_info() { ?> </pre> <ul> This is test gibberish </ul> Quote Link to comment https://forums.phpfreaks.com/topic/264461-trouble-with-functions-syntax-please-help/#findComment-1355273 Share on other sites More sharing options...
Kimomaru Posted June 19, 2012 Author Share Posted June 19, 2012 Hi requinix, Thank you for replying. I originally tried that before posting (and just tried it now) and it still won't render it Does that mean that the problem must be somewhere else on the main page? Confounding . . . Quote Link to comment https://forums.phpfreaks.com/topic/264461-trouble-with-functions-syntax-please-help/#findComment-1355296 Share on other sites More sharing options...
Kimomaru Posted June 19, 2012 Author Share Posted June 19, 2012 Hi requinix, I figured out the problem. My site_fns.php file was calling up .php files that do not exist yet, so it was running into errors and not rendering the site_fns.php file's content. When I commented those out, everything works fine now. Thank you for your help, it was very much appreciated Quote Link to comment https://forums.phpfreaks.com/topic/264461-trouble-with-functions-syntax-please-help/#findComment-1355301 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.