[pk_autoversion]

Description

Link: [pk_autoversion]
Author: Pier Kuipers
Category: Utility
Version: 8.5.x
License: Public Domain
Posted: Feb. 20, 2012
Updated: Jan. 01, 0001
More by this author...
This tag is based on an idea posted on StackOverflow, on how to force-refresh CSS files: http://stackoverflow.com/questions/118884/what-is-an-elegant-way-to-force-browsers-to-reload-cached-css-js-files#118886 Requires rewrite rule in apache config as follows: RewriteRule ^(.*)\.[\d]{14}\.(css|js)$ $1.$2 [L]

Parameters

none


Sample Usage

[pk_autoversion('/css/screen.css')] ->
'/css/screen.20120219213351.css'
						

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
================================================================================
This tag is based on an idea posted on StackOverflow, on how to force-refresh CSS files:
http://stackoverflow.com/questions/118884/what-is-an-elegant-way-to-force-browsers-to-reload-cached-css-js-files#118886
Requires rewrite rule in apache config as follows:
RewriteRule ^(.*)\.[\d]{14}\.(css|js)$ $1.$2 [L]
================================================================================
*/
if(!lasso_tagexists('pk_autoversion'));
    define_tag('autoversion',
        -namespace = 'pk_',
        -required='filename',
        -description='Changes a requested CSS or JS filename to include a datestamp string');
        local('output'=string);
        local('versionstring' = (date(file_moddate(#filename))->format('%q')));
        #output = string_replaceregexp(#filename, -find='^(.*)\.(css|js)', -replace='\\1.'#versionstring'.\\2');
        return(@#output);
    /define_tag;
/if;

 

Comments

none

Email:


Password:



Newest

Most Popular

Support tagSwap.net