How often, when developing/testing a website, did you ask your customer to clear his browser cache?
Ok, your client can clear his cache… But what about a live application? How to tell users to clear their cache?
So, if you’re using headLink and headScript view helpers I think this will help. The main idea is to overload Zend’s headLink and headScript and add a “versioning” parameter at the end of the url.
Everytime you make a change in css/js you just have to update the “version” in application.ini.
Attached you’ll find the two classes that overload Zend’s headLink and headScript view helpers. Add those in “library/Ze”.
In Bootstrap.php, you’ll have to let the “view” know of those scripts, so add this line in “_initView()” method (after you initialize view):
Same thing, in Bootstrap.php, you’ll have to add your config to registry (in case that isn’t added by now):
In the end, don’t forget “versions” in application.ini file:
assets.css.version = 1
assets.js.version = 1