PDA

View Full Version : RealTime Template Compressor: Reduces page sizes, loads pages faster, saves Bandwidth


Logician
08-28-2003, 10:00 PM
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 (https://vborg.vbsupport.ru/showthread.php?s=&threadid=35811) and my Advanced Templates: Dynamic Templates Changing according to different conditions (https://vborg.vbsupport.ru/showthread.php?s=&threadid=43325) hack and WebTemplates 2.x: VB Integrated Content Management System (https://vborg.vbsupport.ru/showthread.php?s=&threadid=54875) . It is a very easy to install add (just a few lines in 1 step) yet effective.

I appreciate if you can click INSTALL (https://vborg.vbsupport.ru/misc.php?s=&action=install&threadid=56589) button, if you use the hack. Thank you. :glasses:

Logician
08-29-2003, 08:41 AM
Screenshot:

(Please note: This line will be visible ONLY if you already have your Microstat's hack installed in your server! If you dont have microstats hack, template compressor hack will STILL work and make the same compression, but you will just don't notice this line in your vb pages)

Logician
08-29-2003, 08:42 AM
1- How does this hack work?

It removes unnecessary spaces/line break characters from your templates before they are displayed so reduces the size of page output in ALL vb pages. Every space and line break chars between HTML tags takes 1 byte size in your pages so by removing them page sizes become smaller, pages load faster and you save bandwidth.

2- Can you give a live example?
Say any of your vb templates has this content:



<table>
<tr>
<td>
Hello
</td>
</tr>
</table>



If you count the number of characters in this snippet you would be tricked to think that a html page with this content will take 38 bytes (as each character takes 1 byte). But if you put the code inside a template or .html page and display it, you'll find out that it takes 79 bytes! That 41 extra bytes came from nowhere and eating your bandwidth unnecessarily everytime this page is visited. 32 bytes of these 41 bytes are because of the spaces before < chars which make the HTML tags inlined and thus more readable to the developer. And the rest 7 bytes are lost because each line has an invisible line break characters at the end. You also lost 2 lines for the 2 blank lines at the very beginning and at the very end of the snippet.

However if you wrote the HTML code like this:


<table><tr><td>Hello</td></tr></table>

you would have the exact output but this time your page would take only 38 bytes as there are no more unnecessary spaces or blank lines now.

This is what this hack does. It does NOT change/modify the source code of your templates, but it compress them in realtime whenever they are displayed by a site visitor and make them as if they had written with no spaces and line breaks.

3- But if you remove spaces/line breaks, isn't the display ruined? Are there any downsides of this hack?

The hack does not remove the spaces and line breaks in your own wordings, it just removes them when they are between html tags which are technically useless and unneeded. These spaces are there in the first place so as to make the source code more readable for the developer. But they are actually redundant and eating bandwidth by increasing page size everytime that page is displayed.

I tested the hack extensively in many boards and I can say that it does not bother the display or create any other problems. The only tiny problem I run into is the thread/forum split page links (< [1] 2 3 4 >) getting closer to eachother after hack's installation. No other problems reported.

On the other hands if you have custom javascript codes in your templates, I'm not sure how they can be affected. Default vbulletin javascripts in templates works fine. Also I dont know how the hack is doing with very old or obselete/non-standart browsers. Tested in IE, Netscape and Mozilla and all is fine.

Also if you encounter a display problem in a vb page, first make sure your HTML syntax is correct in your relevant templates that form that page. The hack can be confused in templates where HTML tags are used incorrectly (eg. missing > or < chars etc.). This might happen if you manually customized some templates and used untidy/wrong HTML tags.

4- How much bandwidth is saved with this hack?

It depends. The reduced kilobytes change from page to page because in every page number of removed chars can be different. Also it changes from board to board because how much your templates are cluttered can be different than other boards too, especially if you customized them. If you have many blank lines, inlined design, long spaces between your HTML tags inside your templates, the save will be more. If your templates are already compact, the save will be less.

But to give an estimate I can say that in my tests the hack saved averagely %2 to %5 bandwidth in many boards. If you have Microstats hack installed, you can see how much bandwidth is saved in every vbulletin page while you browse them.

You can read the thread to see users' experience too. Eg. here (https://vborg.vbsupport.ru/showthread.php?postid=429444#post429444) or here (https://vborg.vbsupport.ru/showthread.php?postid=429448#post429448). Also please feel free to share your experience if you have microstats installed and see the gain in your footer.

5- I already have GZIP enabled in my server. How does it go along with this hack? Can I still use this hack?

They can work together and the hack still saves bandwidth even if you have GZIP installed. This is because their compression works differently so having GZIP alone is not sufficent for the compression this hack is doing.

6- I installed the hack but nothing happened?!? I can not see the saved bandwidth line your screenshot displays? Is the hack working? How can I see how much bandwidth is saved?

That line is visible only if you have Teck's Microstats hack installed. If you don't have that hack, template compression hack will still work perfectly and saves bandwidth but you just can not see how much bandwidth you save. In this scenario you won't even notice whether hack is installed or not. To see that line (it is for admin view only), first install Microstats hack and secondly apply the install instructions of this hack which is for the boards that has microstats hack.

7- Do I need Microstats hack to install this hack?
No you don't. This hack will work whether you have Microstats hack or not. But if you have it, you can see how much compression is made by this hack in all vb pages. If you don't have Microstats, then same compression will be performed but you won't know about its stats anymore.


8- What if I go through all templates and remove spaces/new lines manually?

Yes you can and at the end you will have the same bandwidth save in your board that this hack does.
But:
a) It is way a lot of work! There are hundreds of templates you need to edit.
b) It makes your source code hard to read if you later want to change something there as an admin. On the other hand this hack does not touch your source code and it is still readable when you want to edit it, but it just compress it in realtime (only at the moment it is displayed to the user.)

9- After hack is applied, my source code becomes very hard to read! All spaces and new lines are gone!

So isn't this what this hack is suppose to do anyway ;). Also please note that this is so ONLY IF you check the source code in "view source" link of your browser after page is loaded. Your source is still readable and untouched in your edit template pages which is where you access/update them as an admin. So what matters if users can not get a readable source code? It is better cause it is now harder for them to rip it. :)

10- I have a display problem about ......... with this hack? Can you fix it?
No I can't because it is not possible. Just uninstall it. As the hack intends to remove such chars, it is not possible to fix the hack if this removal creates an unexpected problem. (Although no such problems have been experienced with this hack yet, I'm mentioning just in case)

11- Can you put a setting to turn the hack's compression ON and OFF in admin CP/options page.

It can be done but I won't do it, my apologies. Such a change will not add a feature that will make the hack work better or more functional but it is just for make up. I prefer to keep hacks as simple as possible so that they can be easily installed by even newbiews. The hack as it is just 1 step and a few lines of change at the moment which is very easy to install for anyone. I don't want to make the installation sophisticated to add a make up change. If someone feels to add this change, he is welcome to share it here with other hack users.

12- Why didnt you code the hack to remove "HTML comment lines" from templates too? You would save more bandwidth.

Right but at the moment hack's core (the line which makes the removals) is 1 line only and to remove HTML comments I needed to add more lines which might slighly increase PHP time of the script. IMO the gain from HTML comment removal is not worth having these lines. Besides you can easily remove such comments manually from your templates via TEMPLATE SEARCH feature in your admin CP as they are not too many.

13- Does the hack add SQL queries?
Nope, it does not.

14- Does the hack work in all vb versions?

Tested in vb 2.3.0. Though should work in all 2.x.x. VB3 hacks are not allowed while VB3 is in beta stage so please do not ask for a VB3 version.

Brad
08-29-2003, 08:53 AM
Very nice, im going to apply this to vB 3 :D. Great idea, and good documintation as always. :)

assassingod
08-29-2003, 08:56 AM
Today at 10:53 AM Anime-loo said this in Post #4 (https://vborg.vbsupport.ru/showthread.php?postid=429413#post429413)
and good documintation as always. :)

Amen to that!

Cool hack:)

MrNase
08-29-2003, 10:00 AM
check out webmasterplan.com

test your forums before and after installing it :)


Before:

Anzahl der Elemente auf dieser Seite: 17
Seitengr?sse insgesamt (in Bytes): 881916
Theoretische Ladezeit bei Modem 28.8 kps (in Sek.): 244.98
Theoretische Ladezeit bei ISDN 64 kps (in Sek.): 110.24
Bewertung (nach Schulnoten): 6



After:

Anzahl der Elemente auf dieser Seite: 17
Seitengr?sse insgesamt (in Bytes): 845160
Theoretische Ladezeit bei Modem 28.8 kps (in Sek.): 234.77
Theoretische Ladezeit bei ISDN 64 kps (in Sek.): 105.64
Bewertung (nach Schulnoten): 6



Thank you :)

lasto
08-29-2003, 10:16 AM
$versionnum=phpversion(); dont have this in my functions.php so can u give me a clue where im to add it as i have microstats already installed so unsure why i dont have that line.

Logician
08-29-2003, 10:31 AM
Today at 02:16 PM lasto said this in Post #7 (https://vborg.vbsupport.ru/showthread.php?postid=429432#post429432)
$versionnum=phpversion(); dont have this in my functions.php so can u give me a clue where im to add it as i have microstats already installed so unsure why i dont have that line.
If you already have Microstats, you must have this line because it is a part of Microstats code. You can confirm it if you check Microstat's hack's installation document. :)

Check around lines 500-600 in functions.php.

lasto
08-29-2003, 10:37 AM
yeah was me bein dumb search never found it but i did :)

before -

Page generated in 0.12308896 seconds (76.08% PHP - 23.92% MySQL) with 21 queries.
[Debug Mode OFF] [PHP v4.3.2] [GZIP disabled] [Server Load: 0.46 ? 0.46 : 0.39]

After this mini Hack

Page generated in 0.10551906 seconds (73.14% PHP - 26.86% MySQL) with 21 queries.
[Debug Mode OFF] [PHP v4.3.2] [GZIP disabled] [Output: 30.36 Kb. compressed to 28.65 Kb. by saving 1.71 Kb. (5.65%)] [Server Load: 0.73 ? 0.67 : 0.59]

* lasto clicked install

lasto
08-29-2003, 10:38 AM
wow i like this one - ok logician i installed your other hack yesterday and made meself a template in admin cp using web templates now look at savings on this page.

Page generated in 0.09775603 seconds (81.29% PHP - 18.71% MySQL) with 12 queries.
[Debug Mode OFF] [PHP v4.3.2] [GZIP disabled] [Output: 15.22 Kb. compressed to 9.82 Kb. by saving 5.40 Kb. (35.50%)] [Server Load: 0.40 » 0.50 : 0.53]

Logician
08-29-2003, 10:42 AM
Today at 02:38 PM lasto said this in Post #10 (https://vborg.vbsupport.ru/showthread.php?postid=429448#post429448)
wow i like this one - ok logician i installed your other hack yesterday and made meself a template in admin cp using web templates now look at savings on this page.

Page generated in 0.09775603 seconds (81.29% PHP - 18.71% MySQL) with 12 queries.
[Debug Mode OFF] [PHP v4.3.2] [GZIP disabled] [Output: 15.22 Kb. compressed to 9.82 Kb. by saving 5.40 Kb. (35.50%)] [Server Load: 0.40 ? 0.50 : 0.53]
hehe obviously you had way a lot of spaces/line breaks in that page of yours!. I have never seen %35 save before.

lasto
08-29-2003, 10:46 AM
lol u aint seen my coding :)

but dont matter now does it if i use this hack it removes em for me.

Logician
08-29-2003, 10:52 AM
Today at 02:46 PM lasto said this in Post #12 (https://vborg.vbsupport.ru/showthread.php?postid=429451#post429451)
but dont matter now does it if i use this hack it removes em for me.
yes does not matter now since the hack removes them for you while your templates/webtemplates are displayed.

MetroSports82
08-29-2003, 12:34 PM
Great idea, Logician! Very nice. :)

gmarik
08-29-2003, 01:47 PM
Sounds promising. How much percents do you save on your board?

limey
08-29-2003, 02:26 PM
top notch again Logician.

SmEdD
08-29-2003, 02:50 PM
Very nice, gonna try to get it to work on vB3 :)

Logician = The Wise Template Man

NTLDR
08-29-2003, 03:06 PM
[B]Very nice, gonna try to get it to work on vB3 :)

Already ported it to vB3 ;) I have a few problems with spacing between images, but on the plus side its fixed a major problem I had when viewing my site via the University Proxy.

Great hack as allways Logician :D

Bison
08-29-2003, 04:09 PM
Installed!

[Output: 99.74 Kb. compressed to 96.07 Kb. by saving 3.67 Kb. (3.68%)]

EvilLS1
08-29-2003, 08:23 PM
Nice idea.

/me clicks install.

enzo81
08-30-2003, 01:23 AM
i wonder if this can be modified for normal pages as well?

drumsy
08-30-2003, 02:47 AM
Today at 07:31 AM Logician said this in Post #8 (https://vborg.vbsupport.ru/showthread.php?postid=429442#post429442)
If you already have Microstats, you must have this line because it is a part of Microstats code. You can confirm it if you check Microstat's hack's installation document. :)

Check around lines 500-600 in functions.php.


The correct way that line is printed in my functions.php is:

$versionnum = phpversion();

around line 701. Just any FYI. The spacing is different in your instructions.

Also, the second step's code can be found by searching for

$adminstats = '<br />[' . $debugmode . '] [PHP v' . $versionnum . '] [' . $gziptext . ']' . $serverload;

Again also a spacing difference.

My finished line for that portion of the hack is

$adminstats = '<br />[' . $debugmode . '] [PHP v' . $versionnum . '] [' . $gziptext . ']' . $output . $serverload;

Please let me know if that's alright! :)

Logician
08-30-2003, 07:40 AM
Today at 05:23 AM enzo81 said this in Post #21 (https://vborg.vbsupport.ru/showthread.php?postid=429610#post429610)
i wonder if this can be modified for normal pages as well?
If you are using WebTemplates (https://vborg.vbsupport.ru/showthread.php?s=&threadid=54875) to manage your "normal pages", the answer is YES. Otherwise no.. :)

insanctus
08-30-2003, 10:24 AM
Added into my vb3 nice job man.

insanctus
08-30-2003, 10:47 AM
The proof is in the scroll bar.

I took out the hack, viewed the source on my main forum page then put it back in and viewed. Here is a before and after screan.

Do not mind my awsome paint :)

lasto
08-30-2003, 11:47 AM
Today at 12:47 PM insanctus said this in Post #25 (https://vborg.vbsupport.ru/showthread.php?postid=429705#post429705)
The proof is in the scroll bar.

I took out the hack, viewed the source on my main forum page then put it back in and viewed. Here is a before and after screan.

Do not mind my awsome paint :)

yep is deffo worth installing - this should be merged with microstats and vice versa as they both work well together.

insanctus
08-30-2003, 11:54 AM
I think vb3 actualy has a stats in it (although I can not find where to turn it on) sort of funny I can hack it to hell and back but no good at finding already made options lmao.

JulianD
08-30-2003, 04:03 PM
Great hack! I always wanted to do something like this... It's working fine on my site. Thanks.

JulianD
08-30-2003, 04:09 PM
You know, I was thinking about it.. wouldn't be possible to disable this hack only if the Add template name in comments option is active on the control panel?

Hostc
08-30-2003, 06:57 PM
Page generated in 0.13410795 seconds (88.36% PHP - 11.64% MySQL) with 22 queries.
[Debug Mode OFF] [PHP v4.3.2] [GZIP disabled]
[Output: 46.13 Kb. compressed to 43.23 Kb. by saving 2.90 Kb. (6.28%)] [Server Load: 0.00 » 0.00 : 0.00]

Cal Poly Forum
08-30-2003, 07:36 PM
Parse error: parse error in /home/kkwak/public_html/forum/admin/functions.php on line 957

Fatal error: Call to undefined function: vbdate() in /home/kkwak/public_html/forum/admin/sessions.php on line 404



Any idea?
edit: Oh no! The whole board is down and can't seem to restore my SQL Database (giving me an error). :eek:

insanctus
08-30-2003, 10:07 PM
Upload your back up copy (if you did back it up) if not try posting the line 957 in here so that they can better help you.

Crinos
08-31-2003, 12:16 AM
This is a good hack, but unfortunately I can't use it after trying it ... it does remove spaces between tags and makes the page become slightly smaller (I got as much as 12% compression in some pages), but it also removes spaces that should aesthetically be there (those that don't have &nbsp;, for instance) ...

One example include the separation between the page number links in multiple page topics...

they appear 12345...Last Page
instead of the usual
1 2 3 4 5 ... Last Page
and frankly I don't have time to go back to each template and replace the simple spacing with &nbsp; so it would be recognized by the hack as a legitimate spacing...

Sure, I can just modify the default page navigation templates, but those weren't the only templates affected just coz of simple spacing, and it surely defeats the purpose of the hack anyway :D

As I said, this is an excellent hack but I can't incorporate it for aesthetic reasons... keep up the good work tho ... I'm having a blast with the webtemplates :D

heynurse
08-31-2003, 06:21 AM
Nice job Logician! Thanks for the great documentation with your hacks!

oldgamesnu
08-31-2003, 11:11 AM
Seems to work perfectly. Great Work!
--------------------------------------------------
Powered by: vBulletin Version 2.2.9
Copyright ©2000, 2001, Jelsoft Enterprises Limited.

Page generated in 0.24441695 seconds (88.99% PHP - 11.01% MySQL) with 25 queries.
[Debug Mode OFF] [PHP v4.3.2] [GZIP disabled]
[Output: 156.90 Kb. compressed to 148.90 Kb. by saving 8.00 Kb. (5.10%)] [Server Load: 0.00 » 0.01 : 0.00]

msimplay
08-31-2003, 12:03 PM
works fine on the forum but messes up my Vbhome layout when i'm signed in as admin

Logician
08-31-2003, 05:15 PM
Yesterday at 11:36 PM Cal Poly Forum said this in Post #31 (https://vborg.vbsupport.ru/showthread.php?postid=429795#post429795)
Parse error: parse error in /home/kkwak/public_html/forum/admin/functions.php on line 957

Fatal error: Call to undefined function: vbdate() in /home/kkwak/public_html/forum/admin/sessions.php on line 404



Any idea?
edit: Oh no! The whole board is down and can't seem to restore my SQL Database (giving me an error). :eek:
Can not be related to this hack. You obviously applied it wrongly.

Erwin
08-31-2003, 08:46 PM
Very cool! Thanks, mate.

I installed this on my vB3 forums, and integrated it into my own version of microstats. Working very well. :)

Logician
08-31-2003, 09:12 PM
08-30-03 at 08:09 PM JulianD said this in Post #29 (https://vborg.vbsupport.ru/showthread.php?postid=429751#post429751)
You know, I was thinking about it.. wouldn't be possible to disable this hack only if the Add template name in comments option is active on the control panel?
Yes that can be possible:

You need to change this line in the hack

$vartext=preg_replace ("/(\>)(\s*)(\\r\\n)*(\s*)(\<)/", '\\1\\5', $vartext);

as:

if ($addtemplatename==0) { $vartext=preg_replace ("/(\>)(\s*)(\\r\\n)*(\s*)(\<)/", '\\1\\5', $vartext); }


And also add:

global $addtemplatename;


right after:

function dooutput($vartext,$sendheader=1) {


This will enable compression if template name option is turned on in settings page.

Enjoy.. :)

Logician
08-31-2003, 09:17 PM
Yesterday at 04:03 PM msimplay said this in Post #36 (https://vborg.vbsupport.ru/showthread.php?postid=430018#post430018)
works fine on the forum but messes up my Vbhome layout when i'm signed in as admin
Never tried with vbhome (nor have ever used it) so dont know how they along together but I wouldn't expect any problems unless there is a HTML tag untideness (like missing < > etc.) in its source code.

Erwin
09-01-2003, 05:54 AM
Logician, I have to say it again - this is such a great idea! :) Absolutely minimal server overhead for a huge bandwidth saving! :) I use And such a simple concept, easily implemented, yet no one else thought of it. Pure genius.

Logician
09-01-2003, 06:52 AM
Today at 09:54 AM Erwin said this in Post #41 (https://vborg.vbsupport.ru/showthread.php?postid=430303#post430303)
Logician, I have to say it again - this is such a great idea! :) Absolutely minimal server overhead for a huge bandwidth saving! :) I use And such a simple concept, easily implemented, yet no one else thought of it. Pure genius.
Thank you pal.. Great you liked it! :)

KuraFire
09-01-2003, 09:42 AM
08-30-03 at 10:40 AM Logician said this in Post #23 (https://vborg.vbsupport.ru/showthread.php?postid=429650#post429650)
If you are using WebTemplates (https://vborg.vbsupport.ru/showthread.php?s=&threadid=54875) to manage your "normal pages", the answer is YES. Otherwise no.. :)


Actually, this will just work for EVERY page that you output using vBulletin's doooutput function. That doesn't limit one to Webtemplates at all, most of my entire site is done using vB's dooutput function (and all of KFN 6 will be done using vB3's print_output() function), and as such this hack will apply to all those pages. :)

works fine in vB3 as well btw, I just placed the code (with tiny changes) in vB3's print_output function in the proper place, works like a charm. Dunno yet if I'm gonna keep it though, unformatted source code might be 'more difficult for people to rip', but usually people don't rip sourcecode, they learn from sourcecode. Lack of proper indenting also looks unprofessional...

Erwin
09-01-2003, 10:44 AM
One side effect - this hack does remove spaces in between images in the output as well. No big deal, but the buttons in the postbit are cramped next to each other. :)

Logician
09-01-2003, 11:17 AM
Today at 02:44 PM Erwin said this in Post #44 (https://vborg.vbsupport.ru/showthread.php?postid=430356#post430356)
One side effect - this hack does remove spaces in between images in the output as well. No big deal, but the buttons in the postbit are cramped next to each other. :)
As a matter of fact all these minor side effects can be cured by using &nbsp; instead of spaces in the affected templates. ;) It is a better syntax as far as HTML is concerned too.

Actually, this will just work for EVERY page that you output using vBulletin's doooutput function. That doesn't limit one to Webtemplates at all, most of my entire site is done using vB's dooutput function (and all of KFN 6 will be done using vB3's print_output() function), and as such this hack will apply to all those pages.
That is right. The hack applies to all VB pages so if your regular pages are vb integrated too, you'll have the compression in them as well. But the question was whether the hack can be applied to regular (non-vb integrated) pages or not and the answer is no unless user uses a vb-integrated solution such as webtemplates. :)

lasto
09-01-2003, 12:37 PM
i noticed the buttons where all together and thought it was me

ok will fix with command above cheers

StrykerContact
09-02-2003, 04:54 AM
This is great, I use to use this sort of thing to compress my html pages.

Kriek
09-02-2003, 11:25 AM
Excellent, though there seemed to be thousands of instances spanning thirteen styles/skins where I would need to replace relevant spaces with & nbsp;. So I decided to replay the backup functions file.

Sebastian
09-02-2003, 09:44 PM
Logician, this is a great hack. However, i will not use it because i am too picky and html must look readable :p

i know there are many people that like to view the page source, i myself do.

its just a habit by most coders to look at the page source.

you also have to note that 1byte is extremely small, 1,000 bytes is just about 1KB.

there really isn't much you'll be saving, as even a user on 56k would probably not even noticed a difference in 5,000 bytes.

you might save a dollar or two by doing this, but a lot of page source viewers are gonna be like "what a crappy coder"

lol ;):p

seriously though, good thought.
i am trying to focus my time in reducing vbulletin queries. that is what kills me.

Erwin
09-03-2003, 06:30 AM
09-01-03 at 10:17 PM Logician said this in Post #45 (https://vborg.vbsupport.ru/showthread.php?postid=430367#post430367)
As a matter of fact all these minor side effects can be cured by using &nbsp; instead of spaces in the affected templates. ;) It is a better syntax as far as HTML is concerned too.


True, except &nbsp; creates a wider space than a normal HTML whitespace. :) However, I still love your hack. 5% savings is equal to many many gigabytes for me per year.

Logician
09-03-2003, 08:56 AM
Today at 01:44 AM Sebastian said this in Post #49 (https://vborg.vbsupport.ru/showthread.php?postid=430818#post430818)
you also have to note that 1byte is extremely small, 1,000 bytes is just about 1KB.

there really isn't much you'll be saving, as even a user on 56k would probably not even noticed a difference in 5,000 bytes.

I don't agree. If your gain is 5%, this means your speed is also 5% and it is not that trivial considering the fact that it applies to ALL vb pages, not only 1 page.

Besides if you are on a server which you are paying according to your bandwidth consumption (on most dedicated it is so) and you have a high traffic, even %1 or %2 less consumption can make a difference when it comes to paying your server bills especially in the long term.

But if you have a small site eating 2 GB. per month and your host allows you to spend 30 GB. per month, well you may not care about this hack or any other bandwidth related issues which is understandable.


you might save a dollar or two by doing this, but a lot of page source viewers are gonna be like "what a crappy coder"

Oh just the contrary! A professional checking your source code will understand the logic behind instantly and such a comment will come from only a newbie.

As a matter of fact when I check source code of pages, I blame the developer if I notice a lot of inlined lines in the HTML code. It shows that dev. is either unaware of the results of these lines or don't care.

So please label the correct person as "the crappy coder". :glasses:

David Bott
09-03-2003, 01:19 PM
I like the idea of this hack very much. On our site this would make a hugh impact in bandwidth seeing we currently to about 1.7 Terabytes a month. (Yes, you read that right.) But I just could not get past some of of the spacing issues created. I did a quick test of it, it worked very well, but during the short test I got 3 e-mails telling me something is wrong with the spaces on the site. (Like the page links)

Oh well....great job non-the-less.

David Bott
AVS Forum
http://www.avsforum.com

Boofo
09-03-2003, 02:47 PM
Another excellent hack by the "Master". Thank you, sir. ;)

Skyline_GT
09-04-2003, 06:21 AM
nice hack

MaDCaT75
09-04-2003, 07:14 AM
Sorry but this just makes everything look weird on my forums.

insanctus
09-04-2003, 07:23 AM
Hmm it only changed the spacing of my page links in threads, rest was not effected. :)

MaDCaT75
09-04-2003, 07:24 AM
Yeah I just didnt like that part :ermm:

insanctus
09-04-2003, 07:26 AM
all ya have to do as add html code for space, I just do not care enough to lmao.

MaDCaT75
09-04-2003, 07:36 AM
I did that... it looked really weird :ermm:

lasto
09-04-2003, 07:39 AM
all it did to me was make all buttons more compact but the above code fixed that.Besides that i aint noticed nothing weird.

Akex
09-05-2003, 12:25 PM
Thx a lot, il will save bandwith :)

Mickie D
09-05-2003, 02:47 PM
thanks logician

i always look forward to your releases :)

Erwin
09-05-2003, 09:55 PM
09-04-03 at 06:23 PM insanctus said this in Post #56 (https://vborg.vbsupport.ru/showthread.php?postid=431216#post431216)
Hmm it only changed the spacing of my page links in threads, rest was not effected. :)

Easily fix - just edit the pagenav templates and move the space from OUTSIDE the <a link tags to WITHIN the <a link tags. :)

Crinos
09-06-2003, 08:48 AM
There are a lot more "spacing" issues then the ones mentioned above ... the "down arrow" button marking new posts also loses its spacing in forumdisplay ... the postbit buttons all become cramped together in some areas ... forum text links separated by white space all get smashed together, etc ...

I am giving this hack a chance, I really am, by hunting all templates in my test forum that contain visible white space and grumpily replacing them with &nbsp; ... just incorporating the hack isn't enough if you like your page to not look amateurish with all the lost white space...

Even the slightest misalignment makes me cringe, what more for squished links :D

tpearl5
09-07-2003, 11:53 PM
faster load time/less bandwidth usage > a couple spacing issues :)

Very nice! This will definitely be helpful.

Crinos
09-08-2003, 12:07 AM
Today at 05:53 PM tpearl5 said this in Post #65 (https://vborg.vbsupport.ru/showthread.php?postid=432130#post432130)
faster load time/less bandwidth usage > a couple spacing issues :)
Believe me, if it was just a "couple", installing it would be a no-brainer ;)

matthew tucker
09-08-2003, 05:33 AM
I have this code, in a PHP include file called from global.php


if ( $bbuserinfo['userid'] != 0 )
{ $contact_but = '<a href="../forums/showthread.php?s=' . $session['sessionhash'] . '&threadid=125"><img src="../forums/images/top_contact.gif" alt="Contact ASE" border="0"></a>';
$reg_ucp = '<a href="../forums/usercp.php?s=' . $session['sessionhash'] . '"><img border="0" src="../forums/images/top_profile.gif" alt="Here you can view your subscribed threads, work with private messages and edit your profile and preferences"></a>';
$memberhead = '<a href="../forums/memberlist.php?s=' . $session['sessionhash'] . '"><img border="0" src="../forums/images/top_members.gif" alt="Find other users"></a>';
$searchhead = '<a href="../forums/search.php?s=' . $session['sessionhash'] . '"><img border="0" src="../forums/images/top_search.gif" alt="Search"></a>';
$logout = '<a href="../forums/member.php?s=' . $session['sessionhash'] . '&action=logout"><img border="0" src="../forums/images/top_logout.gif" alt="Logout"></a>';


and more like that, its a conditional nav buttons hack. I just put each of the variables and others in my header template


<td align="center" >
$home_but
$forums_but
$cal_but
$links_but
$faq_but
$contact_but
$searchhead
$memberhead
$reg_ucp ...



and usually the buttons (up to twelve of them depending on who's logged in) just wrap around inside the cell using up whatever rows they need.

But using the compressor. they just stay in one long line and push the cell way off to the right.

Is there anything I can do to fix this so that the compressor doesn't mess this up?

Logician
09-08-2003, 08:47 AM
@Matthew: First try to add &nbsp; to your buttons like:
if ( $bbuserinfo['userid'] != 0 )
{ $contact_but = '<a href="../forums/showthread.php?s=' . $session['sessionhash'] . '&threadid=125"><img src="../forums/images/top_contact.gif" alt="Contact ASE" border="0"></a>&nbsp;';
$reg_ucp = '<a href="../forums/usercp.php?s=' . $session['sessionhash'] . '"><img border="0" src="../forums/images/top_profile.gif" alt="Here you can view your subscribed threads, work with private messages and edit your profile and preferences"></a>&nbsp;';
$memberhead = '<a href="../forums/memberlist.php?s=' . $session['sessionhash'] . '"><img border="0" src="../forums/images/top_members.gif" alt="Find other users"></a>&nbsp;';
$searchhead = '<a href="../forums/search.php?s=' . $session['sessionhash'] . '"><img border="0" src="../forums/images/top_search.gif" alt="Search"></a>&nbsp;';
$logout = '<a href="../forums/member.php?s=' . $session['sessionhash'] . '&action=logout"><img border="0" src="../forums/images/top_logout.gif" alt="Logout"></a>&nbsp;';


It should fix the problem. If it does not let us know your source code of your whole page with and without compression.

lasto
09-08-2003, 09:43 AM
&nbsp; does fix the problem logician

matthew tucker
09-08-2003, 11:08 PM
Nope

I did try that, what it does is just put spaces between the buttons, and they stay in a horizontal line rather than wrapping at the table border.

without compression:

<body bgcolor="#9E93C1" text="#000000" id="all" leftmargin="10" topmargin="10" marginwidth="10" marginheight="10" link="#000020" vlink="#000020" alink="#000020">
<!-- BEGIN TEMPLATE: home_header -->
<!-- logo and buttons -->
<div class="txtcenter">

<table border="0" width="100%" cellspacing="0" cellpadding="0" >

<tr>
<td> </td>
<td> </td>
<td align="right"><bold><font face="verdana, arial, helvetica" size="2" >ASE is sponsored by: &nbsp&nbsp&nbsp&nbsp&nbsp</font></bold></td>
</tr>

<!-- logo -->

<tr>
<td valign="top" align="left" >
<a href="index.php?s="><img src="http://www.screeneditors.com/images/aselogocol-230x76.gif" border="0" alt="Australian Screen Editors Guild" align="left" ></a> </td>

<!-- buttons -->

<td align="center" >
<!-- buttons defined in ./forums/buttons.php -->
<a href="../index.php?s="><img src="../forums/images/top_home.gif" alt="Home" border="0"></a>
<a href="../forums/index.php?s="><img border="0" src="../forums/images/top_forums.gif" alt="Discussion Forums and Archives"></a>
<a href="../forums/calendar.php?s="><img src="../forums/images/top_calendar.gif" alt="Events Calendar" border="0"></a>
<a href="../forums/links.php?s="><img border="0" src="../forums/images/top_links.gif" alt="Useful Links"></a>
<a href="../forums/misc.php?s=&action=faq"><img src="../forums/images/top_faq.gif" alt="Frequently Asked Questions" border="0"></a>
<a href="../forums/showthread.php?s=&threadid=125"><img src="../forums/images/top_contact.gif" alt="Contact ASE" border="0"></a>
<a href="../forums/search.php?s="><img border="0" src="../forums/images/top_search.gif" alt="Search"></a>
<a href="../forums/memberlist.php?s="><img border="0" src="../forums/images/top_members.gif" alt="Find other users"></a>
<a href="../forums/usercp.php?s="><img border="0" src="../forums/images/top_profile.gif" alt="Here you can view your subscribed threads, work with private messages and edit your profile and preferences"></a>
<a href="../forums/member.php?s=&action=logout"><img border="0" src="../forums/images/top_logout.gif" alt="Logout"></a>
<a href="../forums/admin/index.php?s="><img border="0" src="../forums/images/top_admincp.gif" alt="Admincp"></a>
<a href="../forums/mod/index.php?s="><img border="0" src="../forums/images/top_mods.gif" alt="Moderators"></a> <br/>

</td>
<!-- sponsors -->

<td valign="top" align="right"><a href="../sponsors.htm"><img src="forums/logos/Atlab_230x76_1.gif" border="0" alt="Sponsors"></a></td>

</table>

with compression:

<body bgcolor="#9E93C1" text="#000000" id="all" leftmargin="10" topmargin="10" marginwidth="10" marginheight="10" link="#000020" vlink="#000020" alink="#000020"><!-- BEGIN TEMPLATE: home_header --><!-- logo and buttons --><div class="txtcenter"><table border="0" width="100%" cellspacing="0" cellpadding="0" ><tr><td></td><td></td><td align="right"><bold><font face="verdana, arial, helvetica" size="2" >ASE is sponsored by: &nbsp&nbsp&nbsp&nbsp&nbsp</font></bold></td></tr><!-- logo --><tr><td valign="top" align="left" ><a href="index.php?s="><img src="http://www.screeneditors.com/images/aselogocol-230x76.gif" border="0" alt="Australian Screen Editors Guild" align="left" ></a></td><!-- buttons --><td align="center" ><!-- buttons defined in ./forums/buttons.php --><a href="../index.php?s="><img src="../forums/images/top_home.gif" alt="Home" border="0"></a><a href="../forums/index.php?s="><img border="0" src="../forums/images/top_forums.gif" alt="Discussion Forums and Archives"></a><a href="../forums/calendar.php?s="><img src="../forums/images/top_calendar.gif" alt="Events Calendar" border="0"></a><a href="../forums/links.php?s="><img border="0" src="../forums/images/top_links.gif" alt="Useful Links"></a><a href="../forums/misc.php?s=&action=faq"><img src="../forums/images/top_faq.gif" alt="Frequently Asked Questions" border="0"></a><a href="../forums/showthread.php?s=&threadid=125"><img src="../forums/images/top_contact.gif" alt="Contact ASE" border="0"></a><a href="../forums/search.php?s="><img border="0" src="../forums/images/top_search.gif" alt="Search"></a><a href="../forums/memberlist.php?s="><img border="0" src="../forums/images/top_members.gif" alt="Find other users"></a><a href="../forums/usercp.php?s="><img border="0" src="../forums/images/top_profile.gif" alt="Here you can view your subscribed threads, work with private messages and edit your profile and preferences"></a><a href="../forums/member.php?s=&action=logout"><img border="0" src="../forums/images/top_logout.gif" alt="Logout"></a><a href="../forums/admin/index.php?s="><img border="0" src="../forums/images/top_admincp.gif" alt="Admincp"></a><a href="../forums/mod/index.php?s="><img border="0" src="../forums/images/top_mods.gif" alt="Moderators"></a><br/></td><!-- sponsors --><td valign="top" align="right"><a href="../sponsors.htm"><img src="forums/logos/AAV_Australia_230x76_1.jpg" border="0" alt="Sponsors"></a></td></table>

with compress ion and spaces

<body bgcolor="#9E93C1" text="#000000" id="all" leftmargin="10" topmargin="10" marginwidth="10" marginheight="10" link="#000020" vlink="#000020" alink="#000020"><!-- BEGIN TEMPLATE: home_header --><!-- logo and buttons --><div class="txtcenter"><table border="0" width="100%" cellspacing="0" cellpadding="0" ><tr><td></td><td></td><td align="right"><bold><font face="verdana, arial, helvetica" size="2" >ASE is sponsored by: &nbsp&nbsp&nbsp&nbsp&nbsp</font></bold></td></tr><!-- logo --><tr><td valign="top" align="left" ><a href="index.php?s="><img src="http://www.screeneditors.com/images/aselogocol-230x76.gif" border="0" alt="Australian Screen Editors Guild" align="left" ></a></td><!-- buttons --><td align="center" ><!-- buttons defined in ./forums/buttons.php --><a href="../index.php?s="><img src="../forums/images/top_home.gif" alt="Home" border="0"></a>&nbsp;
<a href="../forums/index.php?s="><img border="0" src="../forums/images/top_forums.gif" alt="Discussion Forums and Archives"></a>&nbsp;
<a href="../forums/calendar.php?s="><img src="../forums/images/top_calendar.gif" alt="Events Calendar" border="0"></a>&nbsp;
<a href="../forums/links.php?s="><img border="0" src="../forums/images/top_links.gif" alt="Useful Links"></a>&nbsp;
<a href="../forums/misc.php?s=&action=faq"><img src="../forums/images/top_faq.gif" alt="Frequently Asked Questions" border="0"></a>&nbsp;
<a href="../forums/showthread.php?s=&threadid=125"><img src="../forums/images/top_contact.gif" alt="Contact ASE" border="0"></a>&nbsp;
<a href="../forums/search.php?s="><img border="0" src="../forums/images/top_search.gif" alt="Search"></a>&nbsp;
<a href="../forums/memberlist.php?s="><img border="0" src="../forums/images/top_members.gif" alt="Find other users"></a>&nbsp;
<a href="../forums/usercp.php?s="><img border="0" src="../forums/images/top_profile.gif" alt="Here you can view your subscribed threads, work with private messages and edit your profile and preferences"></a>&nbsp;
<a href="../forums/member.php?s=&action=logout"><img border="0" src="../forums/images/top_logout.gif" alt="Logout"></a>&nbsp;
<a href="../forums/admin/index.php?s="><img border="0" src="../forums/images/top_admincp.gif" alt="Admincp"></a>&nbsp;
<a href="../forums/mod/index.php?s="><img border="0" src="../forums/images/top_mods.gif" alt="Moderators"></a>&nbsp; <br/></td><!-- sponsors --><td valign="top" align="right"><a href="../sponsors.htm"><img src="forums/logos/Quantel_230x76_2.gif" border="0" alt="Sponsors"></a></td></table>

SmEdD
09-09-2003, 01:01 AM
put nowrap in the <td> area and drop the nbsp;'s

matthew tucker
09-09-2003, 01:27 AM
No that's the OPPOSITE of what I want to do. I WANT the buttons to always wrap ... <td nowrap> forces no wrapping for the cell.

SmEdD
09-09-2003, 01:58 AM
sorry didn't read you post completely ;)

and this is a wild guess but maybe try adding hspace="#" in your image tags.

Logician
09-09-2003, 09:47 AM
Today at 05:27 AM matthew tucker said this in Post #72 (https://vborg.vbsupport.ru/showthread.php?postid=432451#post432451)
No that's the OPPOSITE of what I want to do. I WANT the buttons to always wrap ... <td nowrap> forces no wrapping for the cell.
When I put your source code in DreamWeaver then open in a browser, your images wraps at the end of table row just like you want and this applies to all source codes you quoted above.

Maybe you can point me to the page where you are experiencing the problem so that I can see it myself.

d3nnis
09-19-2003, 07:26 PM
i got a problem...

please see my forum :

http://forums.keeptouch.net/forumdisplay.php?s=&forumid=19

Those page numbers are joining together... how to leave this alone?

d3nnis
09-19-2003, 07:53 PM
i got a problem...

please see my forum :

http://forums.keeptouch.net/forumdisplay.php?s=&forumid=19

Those page numbers are joining together... how to leave this alone?


found my own solution.. at template -> forumdisplay_multipagenav_pagenumber

add a &nbsp; instead of space

Erwin
09-20-2003, 06:00 AM
I uninstalled this hack in the end at my private forums, basically because some members using IE for some reason got really wide threads. Don't ask me why. :)

d3nnis
09-20-2003, 04:39 PM
I uninstalled this hack in the end at my private forums, basically because some members using IE for some reason got really wide threads. Don't ask me why. :)


yeah i am thinking of uninstalling it... i bascially have to find those affected templates and add in &nbsp; not worth... just to save that few percent of space and bandwidth

Dan_UPC
10-03-2003, 01:52 PM
Another problem seems to be that if a template contains " " ie. a space, it is deleted but if the template contains " &nbsp;" then it gets displayed as " &nbsp;" ie. 2 spaces. The script doesn't strip the extra space.

NightWalk8r
10-03-2003, 06:48 PM
great hack :D

-------------------------------------------------------------

Page generated in 0.14696705 seconds (87.31% PHP - 12.69% MySQL) with 18 queries.
[Debug Mode OFF] [PHP v4.3.3] [GZIP enabled - level 1]
[Output: 52.35 Kb. compressed to 49.96 Kb. by saving 2.39 Kb. (4.56%)] [Server Load: 2.92 ? 2.58 : 1.92]

Dan_UPC
10-06-2003, 12:40 PM
I uninstalled this hack in the end at my private forums, basically because some members using IE for some reason got really wide threads. Don't ask me why. :)

I've also found and documented this.

Dan_UPC
10-07-2003, 06:38 AM
With GZIP enabled, this hack is almost redundant ... the savings equate to about 1% or so over and above a GZIPPED page. The reported savings on a GZIP Enabled board are also bogus because it reports the size difference before being put thru GZIP.

Logician
10-07-2003, 07:32 AM
With GZIP enabled, this hack is almost redundant ... the savings equate to about 1% or so over and above a GZIPPED page. The reported savings on a GZIP Enabled board are also bogus because it reports the size difference before being put thru GZIP.
The hack is effective even with GZIP enabled. The hack is removing certain characters from your source code so making it smaller in size. Since your hacked page's source code is now smaller, the gzipped outcome of it will be smaller then the gzipped outcome of unhacked page. The hack is using completely a different algorithm than GZIP to save bandwidth so you can not say it is redundant with GZIP.

If you ZIPed a Microsoft Word document, would it be redundant to remove a few pages of the original document just because you ZIPed? If you remove some pages before the compression, the ZIPed outcome will become smaller, it is simple aritmetic.

But you don't agree, please uninstall it. It is not mandatory to use it..

Dan_UPC
10-07-2003, 10:28 AM
Logician,

I'm not saying that it is 100% redundant but it makes very little difference if you've got gzip turned on ... I tested with gzip on with and without this and the difference is extremely small. It also has bugs that make it a big pain to use on some pages. I'm not complaining, just trying to give a bit of constructive criticism as with a bit of tweaking I can see this being of use to some people.

Erwin
10-07-2003, 11:18 AM
I still can't explain why some threads become wide. Any ideas? The only one I can think of is carriage breaks caused by spaces in HTML are removed.

Dan_UPC
10-07-2003, 11:25 AM
I still can't explain why some threads become wide. Any ideas? The only one I can think of is carriage breaks caused by spaces in HTML are removed.

I'm investigating it at the moment ... should have an answer for you by the end of the week.

Logician
10-07-2003, 01:39 PM
I still can't explain why some threads become wide. Any ideas? The only one I can think of is carriage breaks caused by spaces in HTML are removed.
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.

Logician
10-07-2003, 01:44 PM
BTW. please note I have never tested it in VB3 which may be the reason of your problem..

Dan_UPC
10-07-2003, 02:28 PM
Ok, I've worked out what was causing the really wide tables in my case. I'll post a fix in the next 48hrs.

Red Blaze
10-07-2003, 05:10 PM
whoa! Damn it does load faster! =o

Thanks for the hack. ^__^

Erwin
10-08-2003, 10:01 AM
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. :)

Princeton
10-20-2003, 02:27 AM
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 ....

Logician
10-20-2003, 09:34 AM
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?).. :)

Princeton
10-20-2003, 01:43 PM
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.)

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.

MaDCaT75
10-30-2003, 05:43 AM
I dont like the way this shrinks the page numbers in the thread list I.E. 1234 instead of 1 2 3 4

Rampag33
10-30-2003, 06:33 AM
*** Installed ***

Thanks reloaded the first page and already see how much was saved, Thanks. Simple yet very very effective.

magnus
11-05-2003, 02:07 PM
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!

Princeton
11-05-2003, 03:04 PM
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?

dstruct2k
12-31-2003, 06:14 AM
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.

Logician
12-31-2003, 08:56 AM
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.

Princeton
12-31-2003, 03:01 PM
In vB3, you have more control of Search and Replace.
It's only a headache if you don't know how to use it properly. (It takes some time to get use to it.)

In vB3, you'll find that it has a lot of javascript/comments and "empty" space (found in rendered html source) caused by conditionals. Remove all these space/lines/comments and your site will load quicker and save on bandwidth.

- every little bit counts

EricGT
02-28-2004, 10:10 PM
There are a lot more "spacing" issues then the ones mentioned above ... the "down arrow" button marking new posts also loses its spacing in forumdisplay ... the postbit buttons all become cramped together in some areas ... forum text links separated by white space all get smashed together, etc ...

I am giving this hack a chance, I really am, by hunting all templates in my test forum that contain visible white space and grumpily replacing them with &nbsp; ... just incorporating the hack isn't enough if you like your page to not look amateurish with all the lost white space...

Even the slightest misalignment makes me cringe, what more for squished links :D

It seems to me that there is a pretty simple way to deal with this spacing issue. In the preg_replace statement, instead of eliminating all white-space characters between html tags, replace all white-space characters between html tags with one space. The addition to the file size would be minimal and this would deal with the spacing problem. This is what I did on my site and it is working great.

Thanks for a very helpful hack. My site is using 80 - 90% of two T-1's and a 5% or 6% reduction is bandwidth is meaningful. Eric

Bulent Tekcan
03-07-2004, 09:40 AM
Sorry

Is it available VB3 RC4 ?

Thanks

Logician
03-07-2004, 10:25 AM
Is it available VB3 RC4 ?

I don't use VB3 so not yet.. But will be..

Rampag33
04-20-2004, 11:30 PM
How do you implement this in VB3 gold?

jthorpe
12-02-2004, 10:38 AM
Welp, this screwed up my board a good bit so I removed it, and now many of my templates have added spaces when they didn't before. So now I have to spend a number of hours going back to fix them. On top of that, my CMPS templates have screwed up colors in IE now. Since I'm running Gzip, I don't see the benefit. I guess I should have realized that before installing this hack.

Logician
12-02-2004, 07:00 PM
Welp, this screwed up my board a good bit so I removed it, and now many of my templates have added spaces when they didn't before. So now I have to spend a number of hours going back to fix them. On top of that, my CMPS templates have screwed up colors in IE now. Since I'm running Gzip, I don't see the benefit. I guess I should have realized that before installing this hack.
The version I released in the first post of this thread can not cause such effects if you managed to install it successfully. For starters its compression is in "real time" (ie on the fly) so no templates are actually changed. Hence it is impossible that templates have added spaces even after the removal of the hack.

jthorpe
12-02-2004, 07:20 PM
hmmm, interesting. It wasn't happening before the hack, and everything is still screwed up after removing it. I haven't missed anything on the install or removal so I know the hack is completely gone, yet some of my formatting is still messed up. It has obviously done SOMETHING to my forum. Whatever that is yet, I have yet to discover. I'm not sure if mmcache could be having an issue or not but when I put the hack back, the stuff that's screwed up now goes back to normal, and of course I lose spaces all over the place on the other stuff. Don't know what to tell ya, but the hack did cause this problem.

alqadir
12-18-2004, 09:34 AM
This question might not belong here, so if it does not please remove it.
Let's say I wanted to remove empty excessive white space. So in the code if you see <br /> <br /> <br /> (ie <br /> three times in a row) how would you remove it so that you can have a max of two in a row.

I need this because, everytime the editor edits an html marked up post, at the end of each line it adds <br /> making the post huge if edited a few times