How to force update images and css files in CakePHP?

I have the following problem.

I am coding in CakePHP and I am new. I often have to change some images or css files on a website. And on the website I always see old content, unless I manually press "F5" on the keyboard. And I have to do this at every workplace using this website.

This is annoying, especially because I don’t know where I can find a solution for it. I deleted tmp files and cookies. Nothing helps, and I don’t know how to fix it.

could you help me?

+8
cakephp
source share
1 answer

For anything under \ webroot, see the Asset.timestamp parameter in the Asset.timestamp file:

 /** * Apply timestamps with the last modified time to static assets (js, css, images). * Will append a querystring parameter containing the time the file was modified. This is * useful for invalidating browser caches. * * Set to `true` to apply timestamps when debug > 0. Set to 'force' to always enable * timestamping regardless of debug value. */ Configure::write('Asset.timestamp', true); 


To do this, you need to use Cake helpers to create assets (e.g. $this->Html->image() , $this->Html->css() , etc.)

+15
source share

All Articles