Traveltech Posted February 23, 2013 Share Posted February 23, 2013 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 More sharing options...
Larry Posted February 25, 2013 Share Posted February 25, 2013 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 More sharing options...
Traveltech Posted February 25, 2013 Author Share Posted February 25, 2013 Thanks for the clear explaination Larry. I understand fully now. I'm stepping through the book slowly, but learning a great deal. Link to comment Share on other sites More sharing options...
Larry Posted February 26, 2013 Share Posted February 26, 2013 Glad to hear it! Link to comment Share on other sites More sharing options...
Recommended Posts