Jump to content
Larry Ullman's Book Forums

The Config File


Recommended Posts

  • 4 weeks later...

It depends on your site. You should include any sort of environment data, any functions that you use on almost every page, and any variables you need pre-defined. If you use object oriented stuff, it should include your autoloader, and if you do any custom error reporting, you should throw that in there as well.

 

Mine for my site includes my autoloader, a constant that contains the url of my page, a constant that contains the domain name for my page, a short script for forcing the user to the https version of the site if they are supposed to be there, error handling routines, and a static class that safely handles the post, get, and cookie data. Recently, I added something that sets the default timezone as well.

 

Your include file should not send anything but headers to the user. It should not echo anything at all; don't include a ?> at the bottom of the file either.

Link to comment
Share on other sites

 Share

×
×
  • Create New...