Page 1 of 1

Over-riding my viewers' cached stylesheets

Posted: Tue Aug 10, 2010 9:33 am
by Pseudonym
Hi there, I have a simple question:

I've updated my stylesheet, and refreshed the PHPBB cache. The new stylesheet version is now available. However, my regular visitors have the old version cached in their browser, and it doesn't download the new version unless they hit the browser's Refresh button.

Is there an easy way of getting around this?

My first thought was to rename the stylesheet, and change the HTML template so the browser was forced to look for a new file. But the templating system uses a variable {T_STYLESHEET_LINK} so it's not that easy.

I'm sure this must be a widespread problem for phpbb style developers - what's the solution?

Re: Over-riding my viewers' cached stylesheets

Posted: Tue Aug 10, 2010 11:25 am
by Brf
The HTML template files should not be a problem, since their timestamps have changed.
The problem is with the CSS stylesheet, since the user's browser uses style.php to load that.
You can trick the users' browsers into reloading that by writing a new style.php.

Re: Over-riding my viewers' cached stylesheets

Posted: Wed Aug 11, 2010 5:28 am
by Pseudonym
Hi Brf. That's when I mean - I can rename style.php to style2.php and that would force the browsers to look for a new file. But the HTML template doesn't actually contain style.php. It uses the variable {T_STYLESHEET_LINK} instead. Where can I change the content of this variable?

Re: Over-riding my viewers' cached stylesheets

Posted: Wed Aug 11, 2010 10:53 am
by Brf
There is no need to rename style.php, simply rewrite it so its timestamp changes. Users' browsers should be pulling new versions.