| Webmaster-Showcase.net | Automatic PHP Headers and Footers | ||
How it is configuredPHP has the ability to automatically include a file at the top of your script and/or at the bottom of the script. The names of these files are controlled by entries in the "php.ini" file. On Yahoo! WebHosting, you don't have control of the the "php.ini" file (I wonder when they will fix this?) but they did set up some default names for the header and footer files [you can see this by looking at the phpinfo() output]:
Also, the default search path ("include_path")is set to ".:/include:/usr/lib/php". This means, If you list the contents of the last directory, /usr/lib/php, you will see some empty files named "common_header.inc" and "common_footer.inc". (See the page on the PHP file system to find out how to list this directory.) ImplicationsSo, if you want all the PHP scripts in a particular directory to include the same file at the top of the script, just name the file "common_header.inc" and place it in that directory. If you want all of the PHP scripts on your web site to include the same file at the end of the script, create a directory named "/include" and put the file named "common_footer.inc" in that directory.
I have used this ability to place the "Show Me How" and "Feedback" links at the bottom of all the pages generated by PHP scripts on this web site. NOTE: if you create "/usr/lib/php" on your web site, files in that directory are not accessible when your PHP scripts run. That directory appears to be a global directory and somehow replaces your local copy when the PHP scripts are running. |
|||
| Home |
Show Me How | Feedback |
||
| Last updated: Fri Nov 8 16:45:05 2002 | ||||