"file" Snippets


Asset Cache Buster

 file  time
Use [MivaScript's stime() function](http://www.mivascript.com/item/stime.html) to add a cache-busting parameter to a [style sheet](http://snippets.miva.com/assets/css/main.css). The time returned will be the last time the file was modified, thus making sure users always view the latest version.
Created: 1432324035
View "Asset Cache Buster"
<link rel="stylesheet" href="/assets/css/main.css?v=<mvt:eval expr="stime('/assets/css/main.css')"/>"> <mvt:comment> <!-- Checks the last time this file was modified: http://snippets.miva.com/assets/css/main.css And outputs: <link rel="stylesheet" href="/assets/css/main.css?v=1427216581"> MivaScript's stime() function works a lot like PHP's filemtime() --> </mvt:comment>
 

Asset Cache Buster

 file  time
Use MivaScript's stime () to add a cache-busting parameter to a style sheet. The time returned will be the last time the file was modified, thus making sure users always view the latest version.
Created: 1432323720
View "Asset Cache Buster"
<link rel="stylesheet" href="/assets/css/main.css?v=<mvt:eval expr="stime('/assets/css/main.css')"/>">