| Author |
Message |
Guardian
Site Admin


Joined: Jan 06, 2006
Posts: 4465
Location: Vsetin, Czech Republic
|
Posted:
Tue Feb 22, 2011 11:45 pm |
 
|
We know that forcing server side or browser caching of CSS is 'better' but we also know there are some unwanted side affects, like the cache not being updated instantly if you make changes to your CSS rules.
One simple way around this (in RavenNuke 2.4.x) is to add one line of code to the function addCSSToHead() in mainfile.php
Open mainfile.php and find the function around line 1913
Code:
function addCSSToHead($content, $type='file') {
global $headCSS;
|
ADD AFTER
Code:
$content = ''.$content.'?'.filemtime($content).'';
|
The first three lines of the function should now look like this
Code:
function addCSSToHead($content, $type='file') {
global $headCSS;
// G: versionise the file
$content = ''.$content.'?'.filemtime($content).'';
|
What does this do?
Well, it takes the file name of the CSS file and appends a 'version' number to the file. The 'version' number is based on the files timestamp so if you make changes to your CSS file, the files timestamp changes and therefore, the version number changes also to force the new file name to be cached. The best way to see it in action is to view the source code for this site.
NB: Please note that if you are using one of my modules released in 2011 (CA Helpdesk and CA Testimonials and the updated Contact Plus) , any CSS files used in these modules will already have this type of functionality and will need a minor code change to prevent a conflict.
I have not tested for the scenario where CSS is used 'inline' |
_________________ TPD |
|
|
 |
bestbuildpc
Suspended User

Joined: Jun 03, 2009
Posts: 61
|
Posted:
Wed Feb 23, 2011 4:25 pm |
 
|
Thanks a lot for this little trick
Code:/*
* functions added to support dynamic and ordered loading of CSS and JS in <HEAD> and before </BODY>
*/
function addCSSToHead($content, $type='file') {
global $headCSS;
// G: versionise the file
$content = ''.$content.'?'.filemtime($content).'';
// Duplicate external file?
if (($type == 'file') and (count($headCSS)>0) and (in_array(array($type, $content), $headCSS))) return;
$headCSS[] = array($type, $content);
return;
}
|
I just did it and I can't see any conflict yet.  |
| |
|
|
 |
Guardian
Site Admin


Joined: Jan 06, 2006
Posts: 4465
Location: Vsetin, Czech Republic
|
Posted:
Wed Feb 23, 2011 5:28 pm |
 
|
The conflict will only be seen on the index module pages for the modules listed in my post above.
I'm trying to get them updated now to remove that bit of code. |
_________________ TPD |
|
|
 |
bestbuildpc
Suspended User

Joined: Jun 03, 2009
Posts: 61
|
Posted:
Sun Feb 27, 2011 9:28 am |
 
|
Ok. Thanks, let me know when this is done to update it. |
| |
|
|
 |
John Haywood
Newbie


Joined: Jan 04, 2006
Posts: 3
Location: UK
|
Posted:
Sun Feb 27, 2011 10:35 am |
 
|
A new version of Helpdesk will be available in the next few days - see Project Tracking center block. |
| |
|
|
 |
bestbuildpc
Suspended User

Joined: Jun 03, 2009
Posts: 61
|
Posted:
Sat Jul 28, 2012 2:36 pm |
 
|
I bought this module but it doesn't show to download on your shop area. Let me know when u arrive asap. |
| |
|
|
 |
Guardian
Site Admin


Joined: Jan 06, 2006
Posts: 4465
Location: Vsetin, Czech Republic
|
Posted:
Mon Aug 06, 2012 10:04 pm |
 
|
| bestbuildpc wrote:
|
|
I bought this module but it doesn't show to download on your shop area. Let me know when u arrive asap.
|
Existing clients were given credits when we changed the Shop last year, so if you have not used those credits on different software, you should be able to purchase the software for free. At the final stage of purchasing, you should see that the actual charge is 0.00 if you have not used all your credits up.
If you have purchased this within the last 3 weeks and it isn't showing in the downloads area, let me know and I'll find an internet cafe so I can access the Shop and check it for you (the firewall here does not allow me to log in). |
_________________ TPD |
|
|
 |
|
|