PDA

View Full Version : Offline Template Compressor


Andreas
13 Jul 2004, 21:55
This hack is similar to Logicians Realtime Template Compressor
(http://www.vbulletin.org/forum/showthread.php?t=56589), but uses
a slightly different approach:

Instead of doing the compression realtime when the pages are
generated, it compresses the templates right in the database when they
are being saved, so there will be zero overhead during normal operation.
The templates will still look normal when you edit them, just the
parsed versions will be compressed.

Currently this hack does not touch JavaScript, so there should be
no issues with that.
(JavaScript could also be compressed, but then there must be no
comments in it)

Results may vary, but this could reduce traffic approx. 5-10%,
even if you use GZip (recommended).

Details
-------
Difficulty: Easy
Files to modify: 1

Polo
14 Jul 2004, 00:37
Thanks for sharing your hack with the community

corsacrazy
14 Jul 2004, 01:22
what improovments on load time ?

MrNase
14 Jul 2004, 05:59
Nett :)

/me clicks install...

NuclioN
14 Jul 2004, 08:27
How do you create a setting in "vBulletin Options/Server Settings and Optimization Options" ??

TheComputerGuy
14 Jul 2004, 14:20
How do you create a setting in "vBulletin Options/Server Settings and Optimization Options" ??
I believe you have to have debug turned on in the config.php

Princeton
18 Jul 2004, 19:02
great job!

Boofo
18 Jul 2004, 19:10
So if we purposely used a space anywhere in the templates we will need to make it   then to get the space back after compressing?

Andreas
19 Jul 2004, 00:23
Yes, this might be necessary, although I tried to add some code to preserve spaces that are there intentionally, eg. for layout purposes.

tcs
01 Aug 2004, 16:09
I am having trouble getting the files in the phpinclude_start to run. Like the phreak statisick counter and my $banner software.

Any ideas?

Andreas
01 Aug 2004, 22:48
Can you post your phpinclude_start template?

tcs
01 Aug 2004, 23:48
Sure can,


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



It works when I decompress but not while compressed.

I made a phpinclude.php file and then did and include('phpinclude.php') to my index.php but still not luck.

When I View Source of the main page the area where the banners come up is missing the code from the $banner it looks like this:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



I should add that the greeting hack quits working while the templates are in compression.

Andreas
02 Aug 2004, 00:10
Hmm, I don't know why vBulletin does call compile_template() on phpinclude_start as there should be nothing to do in this template ...

Anyway, try to remove


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



I couldn't test the banner & statistics stuff as I don't have the files, but the greeting seems to work then.

tcs
02 Aug 2004, 01:09
That did it, very odd but dosent' matter as long as it work,, right. lol

Andreas
02 Aug 2004, 01:12
It's not thaaat odd:

As vBulletin calls compile_template() your phpinclude_start template will be compress, so afterwards it will look similar to this:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



eg. one line - which is commented out (and thus will not be executed)

Tailfeathers
02 Aug 2004, 03:34
Nice:)

vau7
11 Aug 2004, 17:43
Very nice. I feel an Performance +

vau7
11 Aug 2004, 17:56
HELP!

I upped the master-style again.
And if i reply now on a Thread it looks like here (http://www.board-insel.de/zeugs/failure.JPG). This failure only comes with every Browser.
Everything else went fine. It comes only if your logged in, isnt that strange?

Thank you in advance!!

##edit##
Here is my newreply template:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



##edit##

And if i want to start a new Thread it comes up, too.
It's really mystical that not all Usergroups are affected by this ( Every Group but not the Guests) Curios.

vau7
12 Aug 2004, 14:54
Uninstalled now. Sorry.