Azu Posted December 17, 2006 Share Posted December 17, 2006 You know how when you include an external CSS or JS file the client won't have to keep redownloading the exact same file over and over every single time he reloads the page?Can you please tell me how to do that with PHP/html? Like I have a file called foo.php and it's contents are <?php die("test");?> and I have <?php include"foo.php";?> on one of my pages. How can I make it so that it will work like using <style type='text/css'>@import'foo.css';</style> so that it won't have to keep downloading it over and over? Quote Link to comment Share on other sites More sharing options...
Azu Posted February 2, 2007 Author Share Posted February 2, 2007 Bump... >_>It would be really sweat if someone could tell me how to use this cause I wanna have a bunch of data on every single page without the user having to download it more then once that way the pages load faster and less bandwidth is usedPlease tell me how ;D Quote Link to comment Share on other sites More sharing options...
Azu Posted February 4, 2007 Author Share Posted February 4, 2007 BumpI wish there was a way to bump without making a new post.. Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 4, 2007 Share Posted February 4, 2007 Did you try any of the ones in the first page of results on Google? I searched for PHP Cache and there are plenty of tools. Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted February 4, 2007 Share Posted February 4, 2007 you use the header() function. this can come in handy lots of times. but here is the one your looking for:http://www.badpenguin.org/docs/php-cache.htmlhope thats what you want. Quote Link to comment Share on other sites More sharing options...
Azu Posted February 4, 2007 Author Share Posted February 4, 2007 Thanks I already know that though and it isn't what I'm looking for.Let me give you an exampleA huge fat CSS menu that links to every single page on the site.. around 100kb.. on every single page. I need to make it so that it only needs downloaded once, rather then being downloaded every time the page loads. You know how you can tell the browser to use an external .css or .js file in every single page and it will only have to download it once instead of having to download it on every single page? That is what I need to do, except with PHP generated html instead of with css or js.It's updated every few days so it will need to be re-downloaded once in a while, but not on every single page load. Quote Link to comment Share on other sites More sharing options...
ShogunWarrior Posted February 4, 2007 Share Posted February 4, 2007 Ah, the only way to do this is to use a frame which would contain the menu code, and therefore the browser would not need to re-download the whole page even if the content is different.However, frames aren't really a very good solution.You _could_ use a cacheable javascript file to dynamically write the menu but this is a non-accessible and ugly solution.In the end, shrinking the size of the menu is your best option. Quote Link to comment Share on other sites More sharing options...
Azu Posted February 4, 2007 Author Share Posted February 4, 2007 Okay thanks. I'm not sure I understand how putting it into a frame would help though. If it was in a frame then when I clicked on it wouldn't it just goto that page in the frame?Oh and I'd really like to avoid using javascriptAnd here is the format my menu is in right now. How can I make it more optimized?[code]<div id="a"><ul id="b"><li class="c"><a href=/Map>Click here if the menu doesn't work</a><ul><li><a href=/1>1</a></li><li><a href=/2>2</a></li><li><a href=/3>3</a></li><li><a href=/etc>etc</a></li></ul></li></ul></div>[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.