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