TIP: cached web pages
When developing Web pages,theres nothing so frustrating as making a change and the browser not displaying the result properly. Perhaps the browser has cached the page, and pressing refresh does not work, because it is still displaying the broken copy.
In that case, try CTRL + refresh. If it fixes the problem, you can continue developing. However, bear in mind that your visitors might not be aware that they are seeing cached content. How do you correct that for them?
Try this snippet at the top of every page, in the <HEAD> section:
< meta http-equiv="Pragma" content="no-cache" >
< meta http-equiv="no-cache" >
< meta http-equiv="Expires" content="-1" >
< meta http-equiv="Cache-Control" content="no-cache" >
But wait! what if you have 1,000's of pages? You could do it manually, you could even use a shell script or some PERL wizardry to find all the pages and inject the code into the headers, or you could use a template engine, like Smarty! and insert it just once (in your page header template), and it will appear on every page!!
In that case, try CTRL + refresh. If it fixes the problem, you can continue developing. However, bear in mind that your visitors might not be aware that they are seeing cached content. How do you correct that for them?
Try this snippet at the top of every page, in the <HEAD> section:
< meta http-equiv="Pragma" content="no-cache" >
< meta http-equiv="no-cache" >
< meta http-equiv="Expires" content="-1" >
< meta http-equiv="Cache-Control" content="no-cache" >
But wait! what if you have 1,000's of pages? You could do it manually, you could even use a shell script or some PERL wizardry to find all the pages and inject the code into the headers, or you could use a template engine, like Smarty! and insert it just once (in your page header template), and it will appear on every page!!
Labels: cache, caching, content, header, meta tags, refresh, smarty, template


0 Comments:
Post a Comment
<< Home