include file extensions
Posted 03 April 2006 - 08:57 PM
1. Can I give them any extension I want? What is the best (.php .inc .txt)?
2. Does it matter if I have loads of includes in one page. I plan to have a template with 7 different include files (albeit small) to make maintenance/content easier to manage.
Thanks in advance.
Posted 03 April 2006 - 10:25 PM
But bear in mind the file is treated as plain text so if you want to include more php code the included file must be a valid stand alone script (it must have the <?php and ?> tags in there.)
You can include as many things as you like - but have a look at using include_once and the require equivalents also they can really help especially in big files when you are not sure what you have or have not included yet.
Be sure to refrain from having paths to includes being generated from user input. If it is absolutely neccessary use $_SERVER['DOCUMENT_ROOT'] at the start of the path - this will prevent them from including files on another server which could easily breach your own security.
Posted 04 April 2006 - 11:11 AM
One tip I would recommend you to do is prehaps save your files as filename.inc.php so you can easily identify your files that get included from the normal .php files.
Posted 05 April 2006 - 11:29 PM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users