![]() |
RealTime Template Compressor
Hey could someone port this to vB3:
https://vborg.vbsupport.ru/showthread.php?t=56589 I'd really really like this. :D |
When time comes, it will be ported to VB3 by its author.
|
;) thanks Logician
|
I didnt work on this yet so this is just a thought but this hack can be problematic in VB3 though. VB3's javascript/DHTML structure is more sophisticated than VB2 (eg. WYSIWYG post area etc.) and removing spaces/new lines can cause some bugs. We'll see when I start to work on it. :)
|
I think it might be a good idea not to do this realtime, but when the templates are being parsed for conditionals (eg. in process_template_conditionals).
This way there would be no overhead when serving pages :) Does anybody have figures about the decrease when GZIP (level 1) is enabled? |
Quote:
|
Quote:
The only workaround is to compress the template when it is formed and save the compressed form in database. It will save the overhead then but I think it will be a very bad idea because templates will be unreadable to the admin in the edit page as well. :) |
@Logician
It you take a look at the table template, you will see that vB3 keeps two versions of each template in database: Unparsed for editing reasons (field template_un) and a parsed one (template) which is being used for actual page generation. So if you put your code into process_template_conditionals the compression will be only done "once" (each time a template is being saved to database). This way, there would be no overhead when serving the pages, but the original layout (for editing) could still be preserved. |
ok great, I'll look into it, thx! :)
|
Quote:
----------------------------------- Jelsoft has taken giant steps to make vB3 more adaptable; but, it has taken quite a few steps back when implementing javascript into to many of it's pages. They should have placed all javascripts into external files. To take full advantage of the compressor you should compress EVERYTHING (even javascript and css). However, if you do this the user should be aware that they must remove all comment tags from any javascripts found within templates. This could be an option to the user - COMPRESS JAVASCRIPT?, yes/no, 1. And give instructions to search for <!-- || --> || // -- they all must be removed. I'm looking forward to the new release. :) |
One idea for the JavaScript issues:
Before applying the compression replace all instances of <script> ... </script> with $script[x]. Afterwards run a special compression on the script-snippets (which should just ignore <!-- and -->, or maybe strip them but not the text within), then run the compression on the template (as there are no <!-- or // within JavaScripts now there should be no problems) and finally re-substitue the $script[x] with the script(s). |
is it really so nessary with how vB3 is done?
|
You can get information here:
http://leknor.com/code/gziped.php Simply enable it on your forum then enter your forum's url and you can see what benefit you're getting ;) |
faranth,
yes, it does make a difference ... especially in the long run. Less bytes = Less bandwidth / faster rendering (client side) / also, makes it harder to read source code (client side) It's similar to putting entire source code (client side) in one line. I like KirbyDE's idea - about doing the compression before hand.:up: cirisme, two different end results ... not the same thing |
Quote:
|
all you have to do is look at the source code here and you will see a lot of
S P A C E It's really a personal choice. However, as a web professional, I make sure my customers/friends get maximum results for their money. |
Quote:
|
I used the vb2 version and it worked straight up for me. I have been using it for about a two weeks now with no problems. Then again im running a ported version of the vb2 microstats hack that i brought over a while back.
|
All times are GMT. The time now is 04:43 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|