How to setup a style with a date so it prevents caching when the site is updated



# 1 > Update: route

In app->Config->route.php, add the following code

Router::connect('/style:date.css', array('controller' => 'pages', 'action' => 'style'));

 


# 2 > Update: default

In App->View->Layouts->default.php, add the following code

<link href="<?= $this->webroot; ?>style<?= date('dhi', filemtime(APP.'config/core.php')); ?>.css" rel="stylesheet">


# 4 > Update:Pages Controller

In App->Controller->PagesController, add the following code

function style(){
     $file = 'css/a/style.css';
     header("Content-Type: text/css");
     header("Content-Length: " . filesize($file));
    readfile($file);
    exit;
}


 


Other Instructions

Below are many other instructions that show you how to use your UpdateCase application