Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
RealTime Template Compressor: Reduces page sizes, loads pages faster, saves Bandwidth Details »»
RealTime Template Compressor: Reduces page sizes, loads pages faster, saves Bandwidth
Version: 1.00, by Logician Logician is offline
Developer Last Online: Nov 2023 Show Printable Version Email this Page

Version: 2.2.x Rating:
Released: 08-28-2003 Last Update: Never Installs: 78
 
No support by the author.

As you know all vbulletin pages consists of templates and templates consists of HTML (+sometimes javascript) tags.

Nearly in all sites and HTML pages, HTML tags are written in a readable format so that developer can read the source code easily. VB templates abide by this rule too.

However when this "nicely readable" code is called by a visitor, page size unnecessarily increases because of the redundant "spaces" and "line breaks" in the source code which have no useful purpose regarding the page output but is there just for making the source code more readable to the developer.

This hack removes these unnecessary spaces and line breaks from your vbulletin templates AT THE MOMENT they are displayed (in realtime). It does NOT touch your original source code so it is still readable to you when you want to edit it in your admin CP. But it compress the output when they are sent to user's browser.

Removal of these unnecessary characters makes sure:
a) Page output shrinks in all vb pages
b) Thus page loads faster by all visitors
c) You save bandwidth.

Since the removed characters are unnecessary characters, display of your page does NOT change. Please see FAQ below for more info.

This hack is 100% compatible with Teck's Microstat Hack and my Advanced Templates: Dynamic Templates Changing according to different conditions hack and WebTemplates 2.x: VB Integrated Content Management System . It is a very easy to install add (just a few lines in 1 step) yet effective.

I appreciate if you can click INSTALL button, if you use the hack. Thank you. :glasses:

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #92  
Old 10-08-2003, 10:01 AM
Erwin's Avatar
Erwin Erwin is offline
 
Join Date: Jan 2002
Posts: 7,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Logician
Erwin, I guess it should be possible to find the cause when you check the source code of such threads with and without the hack.

I'm not able to track/debug it because I have never experienced such a problem in the boards I have installed the hack. The only display problem I witnessed and reported in the FAQ is the page split links getting closer to eachother.
Yeah, I tried doing this but couldn't figure it out.
Reply With Quote
  #93  
Old 10-20-2003, 02:27 AM
Princeton's Avatar
Princeton Princeton is offline
 
Join Date: Nov 2001
Location: Vineland, NJ
Posts: 6,693
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I added this to a project I'm currently working on ... and I think it's great.

I modified the expression ...
$vartext = preg_replace ("'([\r\t\n])[\s]+'", "", $vartext);

this has been tested only on a non-public vb3 forum

it seems to compress more then the original (view attachment) and it doesn't remove the "space" between the ....
Reply With Quote
  #94  
Old 10-20-2003, 09:34 AM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by princeton
I added this to a project I'm currently working on ... and I think it's great.

I modified the expression ...
$vartext = preg_replace ("'([\r\t\n])[\s]+'", "", $vartext);

this has been tested only on a non-public vb3 forum

it seems to compress more then the original (view attachment) and it doesn't remove the "space" between the ....
Thanks for sharing the info. I haven't tested it yet but from the apperance it looks like it can be the cure for guys who are having visual problems. So after I tested it, I plan to add it to the hack code and make it user selectable inside the code so that everybody can select the compression method as they like.

But I'm confused how come it compresses more than my line as your line seems to remove successive spaces and my line removes them all. BTW it is also weird the original source sizes are different in your each screenshots (as if they belong to different pages?)..
Reply With Quote
  #95  
Old 10-20-2003, 01:43 PM
Princeton's Avatar
Princeton Princeton is offline
 
Join Date: Nov 2001
Location: Vineland, NJ
Posts: 6,693
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Currently, I have the compression as selectable by admin (in case of high server load).

I admit most of the compression is done in the <head> CSS section. (I'm using vb3.)

Quote:
it is also weird the original source sizes are different in your each screenshots (as if they belong to different pages?).
hmm ... I have to re-check.

I must have minimized a block ... new screenshots attached.
Reply With Quote
  #96  
Old 10-30-2003, 05:43 AM
MaDCaT75 MaDCaT75 is offline
 
Join Date: Jul 2003
Location: Southern California
Posts: 718
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I dont like the way this shrinks the page numbers in the thread list I.E. 1234 instead of 1 2 3 4
Reply With Quote
  #97  
Old 10-30-2003, 06:33 AM
Rampag33's Avatar
Rampag33 Rampag33 is offline
 
Join Date: Jun 2002
Location: Houston, Texas
Posts: 162
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

*** Installed ***

Thanks reloaded the first page and already see how much was saved, Thanks. Simple yet very very effective.
Reply With Quote
  #98  
Old 11-05-2003, 02:07 PM
magnus's Avatar
magnus magnus is offline
 
Join Date: Apr 2002
Location: Miami, FL
Posts: 1,107
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by princeton
I added this to a project I'm currently working on ... and I think it's great.

I modified the expression ...
$vartext = preg_replace ("'([\r\t\n])[\s]+'", "", $vartext);

this has been tested only on a non-public vb3 forum

it seems to compress more then the original (view attachment) and it doesn't remove the "space" between the ....
Excellent! This fixed the spacing, plus increased compression. Thanks, princeton!
Reply With Quote
  #99  
Old 11-05-2003, 03:04 PM
Princeton's Avatar
Princeton Princeton is offline
 
Join Date: Nov 2001
Location: Vineland, NJ
Posts: 6,693
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by magnus
Excellent! This fixed the spacing, plus increased compression. Thanks, princeton!
To implement this on your site you should remove all comments found within javascripts embedded in your templates. If you do not remove ... you will receive errors in pages with javascript embedded. For example, wywsiwyg editor will not function as it should.

To do this go into your ADMIN PANEL and do a search and replace for
Search for text:
<script type="text/javascript">
<!--

Replace with Text:
<script type="text/javascript">

Search for text:
//-->
</script>

Replace with:
</script>

You can also do this for <style> but it is not necessary as <style> will work when compressed.

If you think the comments are necessary think again ...
Comments are used to hide code from version 1 and 2 browsers. How many users do you think will visit your site with a 1 or 2 browser? And, if so, the site will not work as it should because they will not be able to interpret the javascript.

A condtional statement checking for browser version should be used to render or not render javascript. Why send javascript bytes that will not be utilized by browser?
Reply With Quote
  #100  
Old 12-31-2003, 06:14 AM
dstruct2k's Avatar
dstruct2k dstruct2k is offline
 
Join Date: Dec 2002
Location: Winnipeg
Posts: 318
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Broke too much of my spacing, and I don't have enough time to redo it all right now. Awesome idea though, I had a 3.6% save.

Maybe I'll give this other compression method a try one day.
Reply With Quote
  #101  
Old 12-31-2003, 08:56 AM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Unfortunately the compression method of princeton creates problems in javascripts as he mentioned above. I confirmed that it compress better and fixes spacing problem but I believe trying to fix all javascripts in all templates is an headache so I prefer to use my compression method. Your call which one you want to use but make sure you fix your javascripts in princeton's method otherwise some features of your board (eg. smilies) will stop.

Frankly speaking I don't see spacing as a problem. It neither interferes with how board functions (it is just visual) nor hard to fix. I dont know how it will do if you have skins or something but in a default vb, it just affects page numbers which is very easy to fix with a one template edit.
Reply With Quote
Reply


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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:18 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05362 seconds
  • Memory Usage 2,314KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (5)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete