Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.5 > vBulletin 3.5 Add-ons
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.1.0, by ShiningArcanine ShiningArcanine is offline
Developer Last Online: Nov 2023 Show Printable Version Email this Page

Version: 3.5.0 Beta 1 Rating:
Released: 06-16-2005 Last Update: 06-16-2005 Installs: 274
Uses Plugins
 
No support by the author.

This is a port of Logican's Realtime Template Compressor hack from vBulletin 2.2.x to vBulletin 3.5.0 Beta 1. I wrote this by rewriting a version of the original hack, that I wrote for my forums when they ran 3.0.x, so that it would function as a plugin for 3.5.0.

I had originally sent this to Logican for him to release it but he replied granting me permission to release it; hence why I'm releasing this.

Installation is very simple. Just import the plugin via vBulletin's "Download / Upload Plugins" page in the Plugin System in the Admin Control Panel and you're done.

I'll try to correct any bugs that you might find. Let me know if you like this plugin and don't forget to click the install link if you install this.

Update History


Version 1.1.0: The expression was replaced with a more efficient one that increases the compression level from approximately 1-2% to approximately 4-8%.
Version 1.0.0: Initial Release

Show Your Support

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

Comments
  #22  
Old 06-17-2005, 06:30 PM
womensden womensden is offline
 
Join Date: Jan 2005
Posts: 77
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I just noticed that in the "new posts" page, the topic titles are crammed against the "go to first new post" icon. There is no space in between. It's fine everywhere else though.
Reply With Quote
  #23  
Old 06-17-2005, 07:32 PM
ShiningArcanine ShiningArcanine is offline
 
Join Date: May 2003
Posts: 105
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That alternate expression was experimental, which is why I said that I was still playing with it. Here is the new one I'm playing with:

Quote:
/(?(?=\r\n)\s)/
It doesn't compress as well but it doesn't seem to remove any necessary whitespaces so it is a strong candidate for the expression I'm putting in 1.1.0 (as I'm not happy with the current level of compression).
Reply With Quote
  #24  
Old 06-17-2005, 08:10 PM
ShiningArcanine ShiningArcanine is offline
 
Join Date: May 2003
Posts: 105
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It seems that I made writing expressions more complicated than it needed to be. ^_^;;

I wrote something entirely new that I think will be much more efficient so I've released version 1.1.0.
Reply With Quote
  #25  
Old 06-17-2005, 08:15 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Your current regex kills whitespaces that are there intentionally.
And you could achieve higher compression if you remove HTML comments.
However, this might cause problems with JavaScript then.
Reply With Quote
  #26  
Old 06-17-2005, 08:39 PM
ShiningArcanine ShiningArcanine is offline
 
Join Date: May 2003
Posts: 105
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

KirbyDE, aren't all of the whitespaces there intentionally? The regex in 1.0.0 was Logician's original regex but it didn't compress things well enough and my attempts at an advanced regex compressed things so well that it killed whitespaces that are necessary for the presentation so I wrote a simpler regex that strips the whitespaces at the beginning of each line.

It doesn't have any effect on how you view the page unless you're viewing the XHTML. If you were viewing the XHTML, you would not have any level of template compression enabled on your forums.

I have this installed on my forums if you want to check it out:

http://www.pokemonfanuniverse.com/forums/

By the way, thanks for the tip regarding the comments. I was considering stripping them in a new version but I didn't realize that stripping them might affect javascript. Looking at the syntax Jelsoft used I could probably strip them either by ensuring they're on a single line or by also requring the whitespace found after "<!--" in comments but not in the javascript (from what I can see).

Edit: Also, if anyone is interested in why vBulletin strips slashes from the plugin upon submit/edit, they'll want to check out this bug report at vBulletin.com:

http://www.vbulletin.com/forum/bugs3...view&bugid=184

It should be fixed in vBulletin 3.5.0 Beta 2 from what I can gather.
Reply With Quote
  #27  
Old 06-17-2005, 08:53 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What about that
Code:
The following line has 4 spaces at the beginning
    Test
Reply With Quote
  #28  
Old 06-17-2005, 09:22 PM
ShiningArcanine ShiningArcanine is offline
 
Join Date: May 2003
Posts: 105
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by KirbyDE
What about that
Code:
The following line has 4 spaces at the beginning
    Test
I'm not aware of any stock code in vBulletin written like that and to be honest, that is supposed to use &nbsp; rather than standard whitespaces. Not to mention modern browsers display one whitespace instead of several consecutive whitespaces in HTML web pages even if there are several consecutive whitespaces.
Reply With Quote
  #29  
Old 06-17-2005, 10:13 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is the stock [code] Tag
It generates <pre>-Tags, which should preserve whitespaces - but you strip them out.
Reply With Quote
  #30  
Old 06-17-2005, 10:36 PM
ShiningArcanine ShiningArcanine is offline
 
Join Date: May 2003
Posts: 105
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by KirbyDE
This is the stock [code] Tag
It generates <pre>-Tags, which should preserve whitespaces - but you strip them out.
That changes things. Are you proposing a better way of doing it that won't strip those whitespaces or are you leaving it up to me?

By the way, shouldn't Logician's orignal regex also have stripped out those whitespaces?
Reply With Quote
  #31  
Old 06-18-2005, 06:47 AM
ja3 ja3 is offline
 
Join Date: May 2004
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I use
$output=preg_replace ('/(\s*)\r\n(\s*)/', "", $output);
$output=preg_replace ('/<!-- .*? -->/',"",$output);

and get about 15% compression, don't know why you still need the \r\n?
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 09:43 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04605 seconds
  • Memory Usage 2,308KB
  • 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
  • (2)bbcode_code
  • (3)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
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (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