1
0

Purge browser cache using a timestamp variable when switching templates.

This should hopefully fix Ian and my problems.
This commit is contained in:
Garvin Hicking
2013-01-28 09:35:34 +01:00
parent 18dcec7bdd
commit 71ee300143
4 changed files with 30 additions and 2 deletions

View File

@ -65,6 +65,7 @@ if ($serendipity['GET']['adminAction'] == 'install' ) {
serendipity_set_config_var('template', htmlspecialchars($serendipity['GET']['theme']));
serendipity_set_config_var('template_engine', isset($themeInfo['engine']) ? $themeInfo['engine'] : 'default');
serendipity_set_config_var('last_template_change', time());
$data["adminAction"] = "install";
$data["install_template"] = htmlspecialchars($serendipity['GET']['theme']);

View File

@ -967,6 +967,14 @@ function serendipity_smarty_init($vars = array()) {
if (!isset($serendipity['smarty_vars']['head_link_stylesheet'])) {
$serendipity['smarty_vars']['head_link_stylesheet'] = serendipity_rewriteURL('serendipity.css');
// When templates are switched, append a specific version string to make sure the browser does not cache the CSS
if (strstr($serendipity['smarty_vars']['head_link_stylesheet'], '?')) {
$serendipity['smarty_vars']['head_link_stylesheet'] .= '&v=' . $serendipity['last_template_change'];
} else {
$serendipity['smarty_vars']['head_link_stylesheet'] .= '?v=' . $serendipity['last_template_change'];
}
}
$serendipity['smarty']->assign(