santiagodelarosa Posted November 21, 2006 Share Posted November 21, 2006 Absolute beginner to php!!I have just converted a simple site from htm pages to php because as it grew larger the include function that php offers was the only solution to stop me going mad ;)I have mainly used php to include various parts of the navigation system but have noticed that each time a page is viewed the whole page loads up including the header and footer. I have saved the menu header and footer in a "template" folder.Is there some way to cache the header/menu/footer php files so that only the text in the middle changes??Any help would be greatly appreciated!!!! Thanks ;D Link to comment https://forums.phpfreaks.com/topic/27973-can-anyone-help-on-a-cache-question/ Share on other sites More sharing options...
taith Posted November 21, 2006 Share Posted November 21, 2006 instead of[code]include();require();[/code]try using[code]include_once();require_once();[/code]that or, in your included files, you have them set to include the header/footer also... Link to comment https://forums.phpfreaks.com/topic/27973-can-anyone-help-on-a-cache-question/#findComment-127953 Share on other sites More sharing options...
bqallover Posted November 21, 2006 Share Posted November 21, 2006 Well, even though you're using the include function the page still arrives as a single file, and as far as I know there's no way around that! The graphics are porbably being cached though.If you want to keep the header/nav system while loading other parts of the site, I'd say the way to go is with either frames/iframes or AJAX, which are different though complementary technologies to PHP. Link to comment https://forums.phpfreaks.com/topic/27973-can-anyone-help-on-a-cache-question/#findComment-127954 Share on other sites More sharing options...
santiagodelarosa Posted November 21, 2006 Author Share Posted November 21, 2006 No luck with include_once :-[Are there any other suggestions as iframes and ajax are not really an option Link to comment https://forums.phpfreaks.com/topic/27973-can-anyone-help-on-a-cache-question/#findComment-127962 Share on other sites More sharing options...
taith Posted November 21, 2006 Share Posted November 21, 2006 with the include_once(); you have to switch ALL of the includes to that... basically... the include_once(); says... if it wasnt included before, include it, else, disregard Link to comment https://forums.phpfreaks.com/topic/27973-can-anyone-help-on-a-cache-question/#findComment-127980 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.