+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: PHP help

  1. #1
    hlmaster is offline x10Hosting Member hlmaster is an unknown quantity at this point
    Join Date
    Sep 2008
    Posts
    9

    PHP help

    I have the following things
    index.php
    Code:
    <php include 'header.php'; 
    ?>
    <php include 'footer.php'; 
    ?>
    <php echo 'header.php'; 
    ?>
    header.php
    Code:
    | <a href="/index.php">Home</a> | <a href="/interesting.php">Interesting Facts</a> |
    its not displaying on my page, whats wrong?
    Last edited by hlmaster; 10-02-2008 at 06:23 PM.

  2. #2
    leafypiggy's Avatar
    leafypiggy is offline Community Advocate leafypiggy is on a distinguished road
    Join Date
    Aug 2007
    Location
    Massachusetts
    Posts
    2,228

    Re: PHP help

    you can't echo a file.

    it should work. can you link me to your site?
    Neil Hanlon | x10Hosting Support Representative
    Neil[at]x10hosting.com
    █ I'm always happy to help. Just ask a question in Free Hosting
    Terms of Service IRC

  3. #3
    Salvatos's Avatar
    Salvatos is offline x10 Lieutenant Salvatos is an unknown quantity at this point
    Join Date
    Jun 2006
    Location
    Québec, Canada
    Posts
    271

    Re: PHP help

    You're not opening your tags correctly. It should be:

    Code:
    <?php include 'header.php'; 
    ?>
    <?php include 'footer.php'; 
    ?>
    <?php echo 'header.php'; 
    ?>
    Or, much better (IMO anyway):
    Code:
    <?php
    include 'header.php';
    ?>
    // (Index content here)
    <?php
    include 'footer.php';
    ?>
    Also, I usually see included files like this: include ('file_path'); with the parentheses, but I don't know if they're mandatory; I guess not.

  4. #4
    dickey's Avatar
    dickey is offline x10 Sophmore dickey is an unknown quantity at this point
    Join Date
    Sep 2008
    Location
    Singapore
    Posts
    128

    Re: PHP help

    when you include a file it is the same as when you made into one file.

  5. #5
    mattura's Avatar
    mattura is offline x10 Elder mattura is an unknown quantity at this point
    Join Date
    Oct 2007
    Posts
    563

    Re: PHP help

    if you use require instead of include, any error during the 'include' will be passed over and the page will continue to load. Using include causes the whole thing to stop and break down.

    After you included the 'header', you do not need to 'echo' it! This has already happened during the include.
    ----
    Life is a game. The conception is terrible but the graphics are amazing!
    matt.elementfx.com

  6. #6
    Salvatos's Avatar
    Salvatos is offline x10 Lieutenant Salvatos is an unknown quantity at this point
    Join Date
    Jun 2006
    Location
    Québec, Canada
    Posts
    271

    Re: PHP help

    Shouldn't require() always be preferred to include() then? And why is it not the case?

  7. #7
    hlmaster is offline x10Hosting Member hlmaster is an unknown quantity at this point
    Join Date
    Sep 2008
    Posts
    9

    Re: PHP help

    Well im not too smart with php and my site is http://halflife.exofire.net I thought I had to echo the file because it wasnt lodaing but I wasnt opening it up right, thank you!

  8. #8
    leafypiggy's Avatar
    leafypiggy is offline Community Advocate leafypiggy is on a distinguished road
    Join Date
    Aug 2007
    Location
    Massachusetts
    Posts
    2,228

    Re: PHP help

    ...

    NO. require stops loading if there is an error. include passes over...
    Neil Hanlon | x10Hosting Support Representative
    Neil[at]x10hosting.com
    █ I'm always happy to help. Just ask a question in Free Hosting
    Terms of Service IRC

  9. #9
    natsuki's Avatar
    natsuki is offline x10 Sophmore natsuki is an unknown quantity at this point
    Join Date
    Sep 2008
    Posts
    112

    Re: PHP help

    leafypiggy is right..

  10. #10
    hlmaster is offline x10Hosting Member hlmaster is an unknown quantity at this point
    Join Date
    Sep 2008
    Posts
    9

    Re: PHP help

    anyways.... I got it fixed, its all loading properly

+ Reply to Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Ever Been Suspended For Using PHP?
    By dragoneye_xp in forum Off Topic
    Replies: 26
    Last Post: 08-16-2009, 07:17 PM
  2. [PHP] Variables in PHP
    By Bryon in forum Tutorials
    Replies: 15
    Last Post: 01-29-2009, 09:46 AM
  3. currently have an application pending php
    By biomasti in forum Free Hosting
    Replies: 1
    Last Post: 09-03-2008, 01:58 PM
  4. php errors galore
    By DMG Online in forum Scripts & 3rd Party Apps
    Replies: 9
    Last Post: 05-17-2008, 06:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers