Turbo-charge your CB Template!

17 years 9 months ago #17382 by miseryhead75
Turbo-charge your CB Template! was created by miseryhead75
I found out how to speed up my Joomla site through compression, but with CB, the user profiles were taking a while to load. Here's a tip for speeding them up!

Find your default template.css file, and add this code to the very top of it:[code:1]<?php
ob_start ("ob_gzhandler"«»);
header("Content-type: text/css; charset: UTF-8"«»);
header("Cache-Control: must-revalidate"«»);
$offset = 60 * 60 ;
$ExpStr = "Expires: " .
gmdate("D, d M Y H:i:«»s",
time() + $offset) . " GMT";
header($ExpStr);
?>[/code:1]

Rename the file to template.php, and upload it to your server, in the same directory as the original template.css. Be sure to backup your original template.css file, incase you have problems!

Then, in the administrator/components/com_profiler/comprofiler.class.php file, find this line, around 1457 for me:[code:1]<link type="text/css" rel="stylesheet" href="' . selectTemplate($ui) . 'template.css" />[/code:1]. Replace it with [code:1]<link type="text/css" rel="stylesheet" href="' . selectTemplate($ui) . 'template.php" />[/code:1]

Check the profiles on your frontend now, and see how quickly the profiles load!

Please Log in to join the conversation.

17 years 9 months ago #17384 by pcjunkie
Replied by pcjunkie on topic Re:Turbo-charge your CB Template!
Nice work!

;)

I will give this a bash when I wake up. (been up all night hacking pixels)

<3

Please Log in to join the conversation.

17 years 9 months ago #17397 by miseryhead75
Replied by miseryhead75 on topic Re:Turbo-charge your CB Template!
Thanks for the compliment! I hope this works out for you as well as it has for me! I'm all about the need for speed...well, when it comes to websites, anyway!

Please Log in to join the conversation.

17 years 9 months ago #17405 by beat
Replied by beat on topic Re:Turbo-charge your CB Template!
Thanks for sharing this booster. B)

Actually, if I understand correctly, your change has effect to enable the browser (and proxies) caching for 1 hour, which is disabled by Joomla (Joomla writes also corresponding headers for that).

There are numerous W3C documents on this subject, and yes, browser caching speeds a lot browsing, including when pressing the back button.

This is actually a Joomla problem, as Joomla does suppose that content can vary at each page load, and also wants to count all hits.

It would make a lot of sense, that this decision be done by webmaster and the cache time (default could be not 0 but maybe 2 minutes) become a global joomla configuration parameter. :)

You should actually post this into the Joomla forum, and give a link here, so we can follow it up there. ;)

Beat - Community Builder Team Member

Before posting on forums: Read FAQ thoroughly -- Help us spend more time coding by helping others in this forum, many thanks :)
CB links: Our membership - CBSubs - Templates - Hosting - Forge - Send me a Private Message (PM) only for private/confidential info

Please Log in to join the conversation.

17 years 8 months ago #18998 by bennieblanco
Replied by bennieblanco on topic Re:Turbo-charge your CB Template!
I aplied this to my template also and it works only i IE

not in firefx

any sugestions?

Please Log in to join the conversation.

17 years 8 months ago #19005 by beat
Replied by beat on topic Re:Turbo-charge your CB Template!
bennieblanco wrote:

I aplied this to my template also and it works only i IE

not in firefx

any sugestions?


That's normal: the fix above does issue a duplicate HTTP header for the caching, in *addition* of that of Joomla (the later states that there is no caching). So the browser has 2 headers to choose from: as usual IE chooses one and FF the other :D. In addition, the specs are saying there should be only one header ;)

That's why this improvement should go into Joomla and not into CB, as I suggested above.

The correct fix is to do the change at the end of main index.php .

Warning: your site might not reflect changes immediately, as *all* pages will then be cached (that's why Joomla does not allow browser caching at the end of index.php).

Beat - Community Builder Team Member

Before posting on forums: Read FAQ thoroughly -- Help us spend more time coding by helping others in this forum, many thanks :)
CB links: Our membership - CBSubs - Templates - Hosting - Forge - Send me a Private Message (PM) only for private/confidential info

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.224 seconds

Facebook Twitter LinkedIn