shedokan Posted May 14, 2008 Share Posted May 14, 2008 I have a website with a template which is being included over and over with each page loaded, so I thought that maybe using include_once will make my pages load faster. is it a good idea or this will not change the loading speed? thanks. Link to comment https://forums.phpfreaks.com/topic/105618-solved-what-should-i-use-include-or-include_once/ Share on other sites More sharing options...
Skittalz Posted May 14, 2008 Share Posted May 14, 2008 the load speed will not change the only difference is that if include_once is used... if it has already been included.. it wont again while the standard 'include' would include the page again Link to comment https://forums.phpfreaks.com/topic/105618-solved-what-should-i-use-include-or-include_once/#findComment-541098 Share on other sites More sharing options...
shedokan Posted May 14, 2008 Author Share Posted May 14, 2008 let's say I include the template from the about page and I go to the home page will it load it? Link to comment https://forums.phpfreaks.com/topic/105618-solved-what-should-i-use-include-or-include_once/#findComment-541112 Share on other sites More sharing options...
PFMaBiSmAd Posted May 14, 2008 Share Posted May 14, 2008 Web servers are stateless. They don't care or know what page was requested before or after any page. Any resources used on any page are destroyed when that page ends. Nothing carries over between pages except what the browser provides, such as a cookie or a parameter on the end of the url. Link to comment https://forums.phpfreaks.com/topic/105618-solved-what-should-i-use-include-or-include_once/#findComment-541233 Share on other sites More sharing options...
shedokan Posted May 15, 2008 Author Share Posted May 15, 2008 thanks, so I guess I will stay with include. Link to comment https://forums.phpfreaks.com/topic/105618-solved-what-should-i-use-include-or-include_once/#findComment-541733 Share on other sites More sharing options...
runnerjp Posted May 15, 2008 Share Posted May 15, 2008 i would jsut use include.... slap it ontop of all pages you need to include the file on Link to comment https://forums.phpfreaks.com/topic/105618-solved-what-should-i-use-include-or-include_once/#findComment-541739 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.