Jump to content
Larry Ullman's Book Forums

Requiring The Config.Inc.Php File Many Times


Recommended Posts

Hello. I was wondering if it would be more efficient to place the line

require('./includes/config.inc.php;

in the header, which (I'm assuming) is included in each page, instead of calling the config file over and over. I'm not a pro-programmer, so I may be unaware of the logic behind the way you've done it.

 

Thanks

Link to comment
Share on other sites

Good question. Thanks. "Efficient" maybe, but not necessarily better. Every page needs the config file and there could be pages that don't use the header. If you put it in the header, you could get complacent and assume the config file has always been included, resulting in bugs on those pages that don't include the header. Plus, I'm generally wary of including one file from within another, especially when they're two different file types/purposes (the header is for HTML and the config is for settings and such).

Link to comment
Share on other sites

 Share

×
×
  • Create New...