
Sometimes after making changes to the website design it is required that users’ browsers would update and refresh the theme files. To solve this issue it is possible to implement the versioning of static files. For instance, one can add a parameter with the theme version number.
So what we need to do is to add the parameter specifying the version number.
We have: http://test.com/js/prototype/prototype.js
It will become: http://test.com/js/prototype/prototype.js?ver=2
To do this, we need to override Mage_Page_Block_Html_Head and change the method of forming addresses of theme static files:
1 2 3 4 5 6 7 8 9 10 11 12 |
…. if ($mergedUrl) { //BelVG Start if(Mage::helper('staticversion')->isEnabled()) { $mergedUrl .= '?ver=' . Mage::helper('staticversion')->getVersion(); } //BelVG End $html .= sprintf($format, $mergedUrl, $params); } else { foreach ($rows as $src) { //BelVG Start if(Mage::helper('staticversion')->isEnabled()) { $src .= '?ver=' . Mage::helper('staticversion')->getVersion(); } //BelVG End $html .= sprintf($format, $src, $params); } } …. |
