quick & easy php question

Discussion in 'HTML & Website Design' started by mattb348, Jul 11, 2007.

  1. #1
    I was just curious, now that I am finnaly starting to learn and use php, if it is better to save an external php file (like footer.php for example) (for use with the PHP INCLUDE function) in the root folder of a website? or is it ok to throw it in a sub-folder name "phpfiles" or something?

    Does it load faster if you have it in the root folder rather than a sub-folder named phpfiles???

    Thanks for any info!
     
    mattb348, Jul 11, 2007 IP
  2. JOGS_DEV

    JOGS_DEV Peon

    Messages:
    136
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Loading time will be the same whether the included file is in the root folder, or buried deep inside several folders.
    However, it is good to keep the include files in appropriate folders at least for neat organization of the web site.
     
    JOGS_DEV, Jul 11, 2007 IP
  3. Amsterdam

    Amsterdam Well-Known Member

    Messages:
    361
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    128
    #3
    I agree with JOGS DEV. When you come back to edit the site when it has grown it will be far easier to find your includes if they are in a separate folder.

    T
     
    Amsterdam, Jul 11, 2007 IP
  4. mattb348

    mattb348 Peon

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thanks for the info guys!
     
    mattb348, Jul 12, 2007 IP
  5. PHPGator

    PHPGator Banned

    Messages:
    4,437
    Likes Received:
    133
    Best Answers:
    0
    Trophy Points:
    260
    #5
    I usually have an index.php file with my layout and the content of the site is seperated into seperate files. For example, index.php?pg=contactus would use the include function to include the contact us form rather than the main page.

    I know this isn't really an answer to your question, but I just want to clarify the importance of including files rather than duplicating content. If you have your header and all your links repeated in every page... you will spend countless time if you simply need to add one link. I made that mistake several times when I first started learning PHP. ;)
     
    PHPGator, Jul 12, 2007 IP