Register Members List Search Today's Posts Mark Forums Read

Reply
 
Mod Options
Compress Forum Templates (Speed up your Forums & Save Bandwidth) Details »»
Compress Forum Templates (Speed up your Forums & Save Bandwidth)
Mod Version: 2.8, by Trigunflame (Coder) Trigunflame is offline
Developer Last Online: Jan 2013 I like it Show Printable Version Email this Page

This modification is in the archives.
vB Version: 3.0.7 Rating: (10 votes - 4.40 average) Installs: 95
Released: 14 Apr 2005 Last Update: Never Downloads: 8
Supported  

Compress Forum Templates & Phrases
Speed up your Forums & Save Bandwidth


Description:

Hi, this is a pretty simple hack that involves compressing the 'compiled' version of your templates, this way it only compresses the part thats to be shown on the forum and not the actual template data you edit.

Background:

Got the idea from Zero Tolerance in buro9's thread:
http://www.vbulletin.org/forum/showthread.php?t=69787

The above hack compresses the page at parse time, while it provides some speed enhancement, on large pages you can actually "negate" the point of using the hack in the first place, because of the overhead in compression.

Thus, the creation of this hack is to provide similiar functionality, but done in the adminCP; and without the overhead of constant compression.

Info:

No Queries. Only query is used when compressing your templates, the rest of the time its just pulling the templates straight out of the database like normal.

Updates:

Version 2.8 - Added Strip Whitespace from Start of JS Line by buro9
Version 2.7 - Option to strip HTML Comments from Compressed Output
Version 2.6 - Removed Phrase Compression altogether, Too Iffy
Version 2.5 - Removed the ASCII \n removal, emails should work now.
Version 2.4 - Had to add editor_jsoptions_size to the Bad Templates array, it also was causing a font selection error.
Version 2.3 - Added Phrase compression support, should help further increase page compression.
Version 2.2 - Slightly Recoded Template compression for faster results.
Version 2.1 - Added php_include templates to bad templates, will not compress these.
Version 2.0 - Recoded Script, added support for certain templates to not compress
Version 1.9 - Re-Added support for InLine Styles.
Version 1.8 - Removed support for InLine Styles, all Style data is left with Linebreaks.
Version 1.7 - Removed support for InLine Javascript, all JavaScript is left with Linebreaks.
Version 1.6 - Fixed Tab problem, tabs are replaced with a single space
Version 1.5 - Removed a part of the SQL.
Version 1.4 - TOTALLY Remade, Works perfect now; Ultimate Compression
Version 1.3 - Adjusted Again
Version 1.2 - Adjusted Stripping regex
Version 1.1 - Added Uncompress Support
Version 1.0 - Release

Install:

Step 1. [ Open admincp/template.php ]
Step 2. [ Go to about line: 1278, or just look for $_REQUEST['do'] == 'edit' ]
Step 3. [ Above Step 2, add the below code ]


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Step 4. [ close admincp/template.php and open admincp/index.php ]
Step 5. [ look for ]


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Step 6. [ below this, add the code ]


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

How-To Run

1. Install
2. In the admincp left navigation, select "Compress Templates".
3. Repeat Step 2 after each modification of your Templates whenever you decide to change something.
4. If you want to uncompress all Templates, select "Uncompress Templates"
5. IF Any Templates Come Out Weird, add the template Name to the Bad Templates Array and Re-Run the Compress Templates.

Download Now

Only licensed members can download files, Click Here for more information.

Supporters / CoAuthors

Screenshots

Click image for larger version

Name:	example.JPG
Views:	1191
Size:	423.0 KB
ID:	25733

Show Your Support

  • To receive notifications regarding updates -> Click to Mark as Installed.
  • This modification may not be copied, reproduced or published elsewhere without author's permission.
Similar Mod
Mod Developer Type Replies Last Post
Compress Forum Templates Trigunflame vBulletin 3.5 Add-ons 185 26 Feb 2012 01:53
Save bandwidth with CSS. Brad vBulletin 2.x Template Modifications 14 05 Nov 2005 18:11

  #46  
Old 16 Apr 2005, 11:24
The Realist's Avatar
The Realist The Realist is offline
 
Join Date: Oct 2001
Real name: Brian
Trigunflame is a gent and solved my problem

HOTM I say
Laters
Reply With Quote
  #47  
Old 16 Apr 2005, 11:28
The Realist's Avatar
The Realist The Realist is offline
 
Join Date: Oct 2001
Real name: Brian
Another problem.

Clicked edit and my page is twice its size?

Not my day?
Reply With Quote
  #48  
Old 16 Apr 2005, 11:35
Trigunflame's Avatar
Trigunflame Trigunflame is offline
 
Join Date: Aug 2002
Real name: Dusty Burns
Originally Posted by The Realist
Another problem.

Clicked edit and my page is twice its size?

Not my day?
Screenshot , and again Im not getting this problem on my test forums.
Attached Images
File Type: jpg fine.JPG (162.5 KB, 36 views)

Last edited by Trigunflame : 16 Apr 2005 at 11:47.
Reply With Quote
  #49  
Old 16 Apr 2005, 11:36
buro9 buro9 is offline
 
Join Date: Feb 2002
Had a nice problem relating to the footer template and the inline javascript.

It compressed to:
<script type="text/javascript"><!-- // There was a vbulletin comment here vBulletin_init(); // Initialize 'Active' Table Cells //activecells_init();//--></script>

The problem with that is that // is a line comment, and then there is no line break, so the whole javascript is commented out, and menu's do not get initialised, etc.

The result is that those swishy JavaScript drop down menus break.

You can fix this by updating your footer template to just have:
<script type="text/javascript">vBulletin_init();/script>

In place of the larger block. That does it for me

Aside from that minor problem, this hack is wonderful.

I'm going to go off and search for other places that might be impacted by this though... recommendation: Don't compress JavaScript at all... leave line breaks in.

Last edited by buro9 : 16 Apr 2005 at 11:38.
Reply With Quote
  #50  
Old 16 Apr 2005, 11:38
Trigunflame's Avatar
Trigunflame Trigunflame is offline
 
Join Date: Aug 2002
Real name: Dusty Burns
Originally Posted by buro9
Had a nice problem relating to the footer template and the inline javascript.

It compressed to:
<script type="text/javascript"><!-- // There was a vbulletin comment here vBulletin_init(); // Initialize 'Active' Table Cells //activecells_init();//--></script>

The problem with that is that // is a line comment, and then there is no line break, so the whole javascript is commented out, and menu's do not get initialised, etc.

The result is that those swishy JavaScript drop down menus break.

You can fix this by updating your footer template to just have:
<script type="text/javascript">vBulletin_init();/script>

In place of the larger block. That does it for me

Aside from that minor problem, this hack is wonderful.

I'm going to go off and search for other places that might be impacted by this though... recommendation: Don't compress JavaScript at all... leave line breaks in.
Buro, did you try the new version? Mutli-Line javascript is left in its standard format short of tabs.

ie. using the updated version, my footer looks like this (Compressed Template):

http://narutotalk.org


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Last edited by Trigunflame : 16 Apr 2005 at 11:42.
Reply With Quote
  #51  
Old 16 Apr 2005, 11:42
buro9 buro9 is offline
 
Join Date: Feb 2002
Nope, everything else is working fine... editors doing their job, popups where needed are working (attachments, i have a translate hack, buddy list, thread replies, etc).

So just that one very small adjustment... and frankly, for the benefit this hack gives I'd opt for the editing of the footer template over reducing the compression the hack does.
Reply With Quote
  #52  
Old 16 Apr 2005, 11:43
buro9 buro9 is offline
 
Join Date: Feb 2002
Originally Posted by Trigunflame
Buro, did you try the new version? Mutli-Line javascript is left in its standard format short of tabs.
Hehe, maybe not

I'll upgrade now
Reply With Quote
  #53  
Old 16 Apr 2005, 11:51
buro9 buro9 is offline
 
Join Date: Feb 2002
It works, but I had to add a line break.

I'm not sure what version of footer I customised (most likely the vb3 beta one that I've been dragging through each update), but it had the <script block directly following the DST correction block:

</if><script

For some reason that I don't want to look into , it would not recognise that as a JS block and was compressing it.

If I moved the <script onto a new line like thus:
</if>
<script

Then it worked perfectly.

As I said though... the footer template is one I modified in vb a long time ago... so this is likely not an issue as viewing the original now shows that they are indeed on new lines already and thus work perfectly.

If anyone has old templates that they've modified though, they hopefully will read this and add the linebreak
Reply With Quote
  #54  
Old 16 Apr 2005, 11:53
boeserwolf boeserwolf is offline
 
Join Date: Jan 2004
Real name: Markus
Hi


And here is the german translation for all german users:
Attached Files
File Type: txt templates_komprimieren.txt (4.4 KB, 4 views)
Reply With Quote
  #55  
Old 16 Apr 2005, 12:12
Trigunflame's Avatar
Trigunflame Trigunflame is offline
 
Join Date: Aug 2002
Real name: Dusty Burns
Update:

Removed support for inline javascript, all javascript stays line-per-line.
Removed support for inline styles, all style data stays line-per-line.
Reply With Quote
  #56  
Old 16 Apr 2005, 12:16
boeserwolf boeserwolf is offline
 
Join Date: Jan 2004
Real name: Markus
Would you please tell me what to change in the code, so that I can change it in the translation too?
Reply With Quote
  #57  
Old 16 Apr 2005, 12:18
Rambo Rambo is offline
 
Join Date: Oct 2003
Hrm,

Here's a little problem with the latest version.
Attached Images
File Type: jpg Screen.jpg (128.1 KB, 40 views)
Reply With Quote
  #58  
Old 16 Apr 2005, 12:26
Trigunflame's Avatar
Trigunflame Trigunflame is offline
 
Join Date: Aug 2002
Real name: Dusty Burns
Originally Posted by Rambo
Hrm,

Here's a little problem with the latest version.
Ok, will try and contact; someone else is having same problem.
Reply With Quote
  #59  
Old 16 Apr 2005, 13:01
Trigunflame's Avatar
Trigunflame Trigunflame is offline
 
Join Date: Aug 2002
Real name: Dusty Burns
Update:

Im workin on the solution, ive identied the problem as a special template.
Reply With Quote
  #60  
Old 16 Apr 2005, 13:11
Trigunflame's Avatar
Trigunflame Trigunflame is offline
 
Join Date: Aug 2002
Real name: Dusty Burns
Update;

Finished, everyone use the newest version of the code.

Problem was a certain template that delt with fonts available from drop down menu, they were being compressed also, causing errors.

Last edited by Trigunflame : 16 Apr 2005 at 13:36.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Mod Options

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Jump


New To Site? Need Help?

All times are GMT. The time now is 13:08.

Layout Options | Width: Wide Color: