Jump to content

Trouble with functions syntax, please help :(


Kimomaru

Recommended Posts

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.

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 :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.