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
  #232  
Old 01-21-2006, 04:22 PM
Guest210212002
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by ryuji
yes. comment out the fist replacment command
Code:
//Logician Hack:
$page_byte=strlen($output);
//$output=preg_replace ('/\r\n(\s*)/', "\r\n", $output);
$output=preg_replace ('/<!-- .*? -->/',"",$output);

$pagenew_byte=strlen($output);
$page_kilobyte=number_format(($page_byte/1024),2);
$pagenew_kilobyte=number_format(($pagenew_byte/1024),2);
$pagesaved_byte=$page_byte-$pagenew_byte;
$pagesaved_kilobyte=number_format((($pagesaved_byte)/1024),2);
$pagesaved_perc=number_format(((100*$pagesaved_byte)/$page_byte),2);
That's the current contents of the plugin. If I'm understanding it correctly, I shouldn't see things like:

Code:
<!-- header Gallery Links-->
When I view my source if the comments are being stripped, correct? One of the main reasons is that I've been writing code for a living for ages now, and I tend to comment the hell out of every change I make. So people viewing my source tend to see some rather interesting comments.

Code:
<!-- What the @#@$ did I screw up this time? -->
Because right now, this is my compression "Savings".

Code:
[Output: 0.00 Kb. compressed to 82.54 Kb. by saving -82.54 Kb. (0.00%)]
Reply With Quote
  #233  
Old 01-22-2006, 02:43 PM
ryuji ryuji is offline
 
Join Date: Jan 2006
Posts: 35
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

put a space before the --> there was a issue with it taking out code it wasnt supposed to.. i introduced the space before the -->
Reply With Quote
  #234  
Old 01-22-2006, 03:26 PM
Guest210212002
Guest
 
Posts: n/a
Default

[high]* Guest210212002 scratches his head
[/high]

There's a space in the original code snippet I posted, but I put another one in anyhow.

Code:
//Logician Hack: 
$page_byte=strlen($output); 
//$output=preg_replace ('/\r\n(\s*)/', "\r\n", $output); 
$output=preg_replace ('/<!-- .*?  -->/',"",$output); 


$pagenew_byte=strlen($output); 
$page_kilobyte=number_format(($page_byte/1024),2); 
$pagenew_kilobyte=number_format(($pagenew_byte/1024),2); 
$pagesaved_byte=$page_byte-$pagenew_byte; 
$pagesaved_kilobyte=number_format((($pagesaved_byte)/1024),2); 
$pagesaved_perc=number_format(((100*$pagesaved_byte)/$page_byte),2);
Still no love from that, I'm still seeing all of my commented stuff.

(Thank you very much for the help btw, ryuji, I appreciate you takin' the time to help me sort this out. )
Reply With Quote
  #235  
Old 01-22-2006, 03:38 PM
Guest210212002
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by thedvs
anyway to put the output in a nice place, some of us use custom skins and the output looks horrible outside the skin gfx and ruins the look of the board

any suggestions appreciated
This won't move it, but if you at least want to change the look of it, add a CSS to you your MAIN statement for it, something like:

Code:
.compressor
{
color: #2886B6;
font: 10px verdana;
}
And then change the span class="smallfont" tag in the plugin itself to span class="compressor".



On a nother note, I'd love it if someone could find a way to make this conditional work. I've tried it in a few places and haven't found something to make it happen.

Code:
$output = str_replace('</body>', '<if condition="in_array($bbuserinfo['usergroupid'], array(6))"><center><span class="compressor">[O: ' . $page_kilobyte . ' Kb C:<b>' . $pagenew_kilobyte . '</b> Kb. S: <b>' . $pagesaved_kilobyte . '</b> Kb. (' . $pagesaved_perc . '%)]</span></center></if></body>', $output); 
//Compressor
Reply With Quote
  #236  
Old 01-22-2006, 06:59 PM
Submerge Submerge is offline
 
Join Date: Jan 2006
Posts: 29
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Running it on 3.5.3 and getting the paragraph break problem on Advanced Edit
Reply With Quote
  #237  
Old 01-22-2006, 09:40 PM
ryuji ryuji is offline
 
Join Date: Jan 2006
Posts: 35
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Chris-777
[high]* Chris-777 scratches his head
[/high]

There's a space in the original code snippet I posted, but I put another one in anyhow.

Code:
//Logician Hack: 
$page_byte=strlen($output); 
//$output=preg_replace ('/\r\n(\s*)/', "\r\n", $output); 
$output=preg_replace ('/<!-- .*?  -->/',"",$output); 


$pagenew_byte=strlen($output); 
$page_kilobyte=number_format(($page_byte/1024),2); 
$pagenew_kilobyte=number_format(($pagenew_byte/1024),2); 
$pagesaved_byte=$page_byte-$pagenew_byte; 
$pagesaved_kilobyte=number_format((($pagesaved_byte)/1024),2); 
$pagesaved_perc=number_format(((100*$pagesaved_byte)/$page_byte),2);
Still no love from that, I'm still seeing all of my commented stuff.

(Thank you very much for the help btw, ryuji, I appreciate you takin' the time to help me sort this out. )
i meant in your templates... you can remove all the spaces but on my templates it removed code it wasnt supposed to when i did that, best way is to download the whole style and then use a find and replace to add a space to all of them
Reply With Quote
  #238  
Old 01-22-2006, 11:01 PM
Smiry Kin's's Avatar
Smiry Kin's Smiry Kin's is offline
 
Join Date: Dec 2005
Location: United Kingdom!
Posts: 954
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

with 3.5.2

and element skil.

it messes up the DHTML thing.. which is a pain really.. any way to sort this?
Reply With Quote
  #239  
Old 01-23-2006, 09:35 AM
mox- mox- is offline
 
Join Date: Nov 2005
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Wow, I just installed it and it seems to be working fine.

Is there a way to remove all <!-- comments --> in the code ? This would save a lot too.
Reply With Quote
  #240  
Old 01-23-2006, 11:50 AM
Totti's Avatar
Totti Totti is offline
 
Join Date: Jul 2005
Location: Germany
Posts: 72
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

mox- read the thread ...
All the last posts are about it

My problem is that i got some
<!--
bloa
bla
blubb
-->
code which is not stripped at all ... any way sorting it out beside making it one line with <!-- xxx --> in code?!?
Reply With Quote
  #241  
Old 01-23-2006, 02:04 PM
lightwave lightwave is offline
 
Join Date: Sep 2004
Posts: 76
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

where did you guys upload it tooo
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 12:06 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.12827 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
  • (8)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
  • (8)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