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.

Link to comment
Share on other sites

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 . . .

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.