PDA

View Full Version : Compress Forum Templates (Speed up your Forums & Save Bandwidth)


Trigunflame
04-13-2005, 10:00 PM
Compress Forum Templates & Phrases
Speed up your Forums & Save Bandwidth
Vote Compress Forum Templates for HOTM (https://vborg.vbsupport.ru/showthread.php?t=79923)

https://vborg.vbsupport.ru/ (https://vborg.vbsupport.ru/vborg_miscactions.php?do=installhack&threadid=79923)

Description:

Hi, this is a pretty simple hack that involves compressing the 'compiled' version of your templates, this way it only compresses the part thats to be shown on the forum and not the actual template data you edit.

Background:

Got the idea from Zero Tolerance in buro9's thread:
https://vborg.vbsupport.ru/showthread.php?t=69787

The above hack compresses the page at parse time, while it provides some speed enhancement, on large pages you can actually "negate" the point of using the hack in the first place, because of the overhead in compression.

Thus, the creation of this hack is to provide similiar functionality, but done in the adminCP; and without the overhead of constant compression.

Info:

No Queries. Only query is used when compressing your templates, the rest of the time its just pulling the templates straight out of the database like normal.

Updates:

Version 2.8 - Added Strip Whitespace from Start of JS Line by buro9
Version 2.7 - Option to strip HTML Comments from Compressed Output
Version 2.6 - Removed Phrase Compression altogether, Too Iffy
Version 2.5 - Removed the ASCII \n removal, emails should work now.
Version 2.4 - Had to add editor_jsoptions_size to the Bad Templates array, it also was causing a font selection error.
Version 2.3 - Added Phrase compression support, should help further increase page compression.
Version 2.2 - Slightly Recoded Template compression for faster results.
Version 2.1 - Added php_include templates to bad templates, will not compress these.
Version 2.0 - Recoded Script, added support for certain templates to not compress
Version 1.9 - Re-Added support for InLine Styles.
Version 1.8 - Removed support for InLine Styles, all Style data is left with Linebreaks.
Version 1.7 - Removed support for InLine Javascript, all JavaScript is left with Linebreaks.
Version 1.6 - Fixed Tab problem, tabs are replaced with a single space
Version 1.5 - Removed a part of the SQL.
Version 1.4 - TOTALLY Remade, Works perfect now; Ultimate Compression
Version 1.3 - Adjusted Again
Version 1.2 - Adjusted Stripping regex
Version 1.1 - Added Uncompress Support
Version 1.0 - Release

Install:

Step 1. [ Open admincp/template.php ]
Step 2. [ Go to about line: 1278, or just look for $_REQUEST['do'] == 'edit' ]
Step 3. [ Above Step 2, add the below code ]


// ################################################## ###########################
// Rebuild Templates Compressed
if ($_REQUEST['do'] == 'compressall')
{
/**
* Compress Templates Mod
*
* Thanks for Idea From Zero Tolerance.
* Thanks for Help & Support From buro9
*
* @author Trigunflame
* @version 2.8
* @copyright Dusty Burns, 2005-2006
*/

// Strip Comments?
// Use true or false
$stripComments = true;

// Search & Replace
$search = array('/\s+/', '/\t+/');
$replace = ' ';
$jsearch = array('/^\s+/', '/\t+/');
$jreplace = array('', ' ');

// Strip Comments
if ($stripComments) { $search[] = '/<!--.*?-->/'; }

// List of Templates to NOT Compress
$badTemplates = array(
'editor_jsoptions_font',
'editor_jsoptions_size',
'phpinclude_start',
'phpinclude_end'
);

// Get Modified Templates
$templates = $DB_site->query(
"SELECT templateid, title, template_un " .
"FROM " . TABLE_PREFIX . "template " .
"WHERE template_un <> '' "
);

// Selectively Compress
while ($template = $DB_site->fetch_array($templates))
{
// Compile Template
$compiledTemplate = compile_template($template['template_un']);

// Bad Template
if (in_array(strtolower($template['title']), $badTemplates))
{
// Ignoring Template
echo "Bad Template [" . $template['templateid'] . "] " . $template['title'] . "<br />\n";

$compressedTemplate = $compiledTemplate;
}

// Reverting Template
else if ($_REQUEST['revert'])
{
// Uncompressing
echo "Uncompressing [" . $template['templateid'] . "] " . $template['title'] . "<br />\n";

$compressedTemplate = $compiledTemplate;
}

// Good Template
else
{
// Compressing
echo "Compressing [" . $template['templateid'] . "] " . $template['title'] . "<br />\n";

// Get All Lines
$compiledTemplate = preg_split('(\r\n|\r|\n)', $compiledTemplate);

// Javascript Status
$js = false;

// Compressed Output
$compressedTemplate = '';

// Loop Lines
foreach ($compiledTemplate AS $line)
{
// LowerCase Line
$lowerLine = strtolower($line);

// Look For Start of JavaScript
if (strpos($lowerLine, '<script') !== false) { $js = true; }

// Check For Null
if (trim($line) == '') continue;

// Check JS Status
if (!$js && !$st)
{
// Full WhiteSpace Strip
$line = preg_replace($search, $replace, $line);
}
else
{
// Straight Output
$line = preg_replace($jsearch, $jreplace, $line) . "\r\n";
}

// Look For End of JavaScript
if (strpos($lowerLine, '</script>') !== false) { $js = false; }

// Check For Null
if (trim($line) == '') continue;

// Append Line
$compressedTemplate .= $line;
}
}

// Update Template
$DB_site->query(
"UPDATE " . TABLE_PREFIX . "template " .
"SET template = '" . addslashes($compressedTemplate) . "' " .
"WHERE templateid = '" . $template['templateid'] . "'"
);
}

// Redirect
print_cp_redirect('index.php?do=home', 1);

/**
* End Compress Templates Mod
*/
}
Step 4. [ close admincp/template.php and open admincp/index.php ]
Step 5. [ look for ]


construct_nav_option($vbphrase['find_updated_templates'], 'template.php?do=findupdates', '<br />');
Step 6. [ below this, add the code ]


construct_nav_option("Compress Templates", 'template.php?do=compressall', '<br />');
construct_nav_option("Uncompress Templates", 'template.php?do=compressall&revert=1', '<br />');
How-To Run

1. Install
2. In the admincp left navigation, select "Compress Templates".
3. Repeat Step 2 after each modification of your Templates whenever you decide to change something.
4. If you want to uncompress all Templates, select "Uncompress Templates"
5. IF Any Templates Come Out Weird, add the template Name to the Bad Templates Array and Re-Run the Compress Templates.
https://vborg.vbsupport.ru/ (https://vborg.vbsupport.ru/vborg_miscactions.php?do=installhack&threadid=79923)

Cyricx
04-14-2005, 07:21 PM
So if I'm understanding you right..

The part the page loads has the spaces stripped, but when you edit the template in the admincp, it has all the spaces there for ease of navigating?

Would it be possible or would it help even more to strip out the html commenting?

DR?@M W?@V?R
04-14-2005, 07:29 PM
I tryed this out and it gave me some javascript errors on showthread and the portal page. This might be just applying to my board however.

Luckly I downloaded a backup of my templates before I tryed it out.

Trigunflame
04-14-2005, 07:40 PM
I tryed this out and it gave me some javascript errors on showthread and the portal page. This might be just applying to my board however.

Luckly I downloaded a backup of my templates before I tryed it out.

I don't get any errors on any of my pages :/

-----------

Ps. Re-Editing a template, resaves the normal version of it, so really you would only need to re-save a template that was causing the js errors. That or fix the JS.

Trigunflame
04-14-2005, 07:41 PM
So if I'm understanding you right..

The part the page loads has the spaces stripped, but when you edit the template in the admincp, it has all the spaces there for ease of navigating?

Would it be possible or would it help even more to strip out the html commenting?

In the database, there are 2 fields were the template is stored as an editable copy, and a output copy.

This script just modifies the output copy, that way the editing copy is still easy to edit.

Trigunflame
04-14-2005, 07:49 PM
Update:

Added support to uncompress all templates.

Trigunflame
04-14-2005, 08:23 PM
Update:

Adjust the whitespace regex, might prevent javascript errors..

The Realist
04-14-2005, 10:15 PM
I installed this hack but when I compress the templates my dropdown menu does not work. When I click it the page just shoots to the top of the screen?

Laters

Trigunflame
04-15-2005, 03:03 AM
I installed this hack but when I compress the templates my dropdown menu does not work. When I click it the page just shoots to the top of the screen?

Laters

Hmm this seems to be an IE problem, I get no errors whatsoever in firefox. IE for some reason doesnt like to "not" have, newlines in JS.

I redid the regex somewhat again, and it works; just not compressing as much as it used to; im gonna keep trying some different methods.

Cyricx
04-15-2005, 11:41 AM
This weekend I'm refreshing my test site with the live site files, then I'll give this a healthy test run :)

Trigunflame
04-15-2005, 12:57 PM
This weekend I'm refreshing my test site with the live site files, then I'll give this a healthy test run :)

Ya this modification is really experimental.. main reason I didn't go into large coding detail or write a very large documentation.

Although after the latest code change, I'm pretty sure it fixed the problem with JS.

buro9
04-15-2005, 03:08 PM
Ya this modification is really experimental.. main reason I didn't go into large coding detail or write a very large documentation.

Although after the latest code change, I'm pretty sure it fixed the problem with JS.
Very nice Trigunflame.

Negates the one I was working on for Zero Tolerence ;) (I'm stuck with a fried hard-drive so it's in limbo... so I really appreciate this being picked up by someone else :))

I'm actually going to install this myself... even though I wrote the compress hack :D

buro9
04-15-2005, 03:36 PM
I've sent an update from my hack to let people know of yours.

I think it's a very valuable addition to any vBulletin admins arsenal of essential hacks :)

Trigunflame
04-15-2005, 03:45 PM
I've sent an update from my hack to let people know of yours.

I think it's a very valuable addition to any vBulletin admins arsenal of essential hacks :)

Ya, unfortunately im not a master in REGEX, the compressing of the templates currently is not optimal in its design.

Since this is editing the actual parsed templates, one one regex needs to be written, not 2 like we are using now..

The problem lies within the JS tags, need to make one that removes whitespace AND tabs,newlines from every tag outside of <!-- // --> and <!-- -->, anything within those, retains its linebreaks and whitespace...

vulture
04-15-2005, 03:52 PM
Very nice Trigunflame.

Negates the one I was working on for Zero Tolerence ;) (I'm stuck with a fried hard-drive so it's in limbo... so I really appreciate this being picked up by someone else :))

I'm actually going to install this myself... even though I wrote the compress hack :D


Can this be used alongside your hack?

Trigunflame
04-15-2005, 03:53 PM
Can this be used alongside your hack?

There would be no point.

Trigunflame
04-15-2005, 03:54 PM
Very nice Trigunflame.

Negates the one I was working on for Zero Tolerence ;) (I'm stuck with a fried hard-drive so it's in limbo... so I really appreciate this being picked up by someone else :))

I'm actually going to install this myself... even though I wrote the compress hack :D

Ya well as I posted above, the original REGEX I was using was not similiar to yours; however until I create one that does what I need i'll have to use it temporarily.

Corriewf
04-15-2005, 06:52 PM
Isnt this adding a query?

Cyricx
04-15-2005, 07:18 PM
It only runs the query when you compress the templates in the admincp. That step.

It doesn't add an additional query to any pages.

Corriewf
04-15-2005, 07:34 PM
Does this work with other hacks that you know of?

Cyricx
04-15-2005, 07:37 PM
I haven't tossed this onto my test site yet, but there isn't any hacks that would contradict this.

He's using add below/above rather then replace code, which is rockin and it's a total new function.

Nothing for it to clash with.

jcr
04-15-2005, 07:53 PM
This hack is truly amazing, I really can feel, see and notice the difference!

Two thumbs up!

Highly recommendable!

diettalk
04-15-2005, 09:20 PM
Added to my forum and it seems to be loading quicker here. My load average jumped up but it seems to be coming down.. probably just eaccelerator updating the cache.

Rambo
04-15-2005, 11:43 PM
Hrm,

I think i can notice a slight difference with this installed, seem's to be working so far.

Good job

Trigunflame
04-16-2005, 06:10 AM
Im almost done with an update guys, Im writing code to take care of the removing of whitespace.

Trigunflame
04-16-2005, 07:15 AM
UPDATE:

Finished the new version, it works great.

Checks template line for line, removing any and all whitespace, tabs etc.. checked the result in IE/Firefox with NO Errors.

Script is made to go "around" the javascript, so its left in its natural state except the tabs.

Blam Forumz
04-16-2005, 07:31 AM
This is brilliant! My forums are so much faster, thanks :D

Blam Forumz
04-16-2005, 07:33 AM
Ok, I have a problem, I use this in my phpinclude_start:


switch(intval(time() / 2) % 4)
{
case 0:
$banner = '/designs/images/skin/boredom.gif';
break;
case 1:
$banner = '/designs/images/skin/boredom1.gif';
break;
case 2:
$banner = '/designs/images/skin/boredom2.gif';
break;
case 3:
$banner = '/designs/images/skin/boredom3.gif';
break;
}


and then i use $banner in my header, when I compress all templates the images dont appear, but when I uncompress them they do, any idea?

Trigunflame
04-16-2005, 07:43 AM
Ok, I have a problem, I use this in my phpinclude_start:


switch(intval(time() / 2) % 4)
{
case 0:
$banner = '/designs/images/skin/boredom.gif';
break;
case 1:
$banner = '/designs/images/skin/boredom1.gif';
break;
case 2:
$banner = '/designs/images/skin/boredom2.gif';
break;
case 3:
$banner = '/designs/images/skin/boredom3.gif';
break;
}


and then i use $banner in my header, when I compress all templates the images dont appear, but when I uncompress them they do, any idea?

Im using this in mine: phpinclude_start


$b = array(
'images/v4/banner01.jpg',
'images/v4/banner02.jpg'
);
$banner = $b[array_rand($b)];


and my header is


<!-- logo -->
<a name="top"></a>
<center>
<table cellpadding='0' cellspacing='1' bgcolor='#C7C5BF' align='center' width="$stylevar[outertablewidth]">
<tr>
<td align='center' bgcolor='#F8F5F0'>
<table border="0" width='100%' cellpadding="0" cellspacing="0" align="center"><tr><td align="$stylevar[left]"><img src="$banner" border="0" alt="$vboptions[bbtitle]" /></td></tr></table>
<!-- /logo -->

<!-- content table -->
$spacer_open

$_phpinclude_output


It's working fine for me, maybe adjust yours to mine?

Blam Forumz
04-16-2005, 07:52 AM
Nope, still doesnt work :(

Blam Forumz
04-16-2005, 07:54 AM
it just displays my alt tag :(

Trigunflame
04-16-2005, 08:52 AM
it just displays my alt tag :(

Update;

Contact with Blamz, fixed problem.

Notice;

Everyone, even if you have installed this hack. REINSTALL it with the latest code, it drastically changes some stuff that would cause errors otherwise..

jcr
04-16-2005, 09:20 AM
New version installed, just one quickie before I do anything;

Should I uncompress before applying the new way to compress?

Edit:

One more thing, the reputation images gets very seperated after this hack :-/

Trigunflame
04-16-2005, 09:28 AM
New version installed, just one quickie before I do anything;

Should I uncompress before applying the new way to compress?

Nah, everytime you select compression, its source is from the "editable" version of the templates.

In other words, everytime you select Compress Templates its compressing them freshly.

jcr
04-16-2005, 09:30 AM
Nah, everytime you select compression, its source is from the "editable" version of the templates.

In other words, everytime you select Compress Templates its compressing them freshly.
wow, great! :) Absolutely great! , See my other edited question also if you have time (about the reputation images), otherwise, thank you for a great hack, and fast support :)

Trigunflame
04-16-2005, 09:36 AM
One more thing, the reputation images gets very seperated after this hack :-/

Mine does'nt :/

Try uncompress/compress, if that doesn't work, paste the html code of posts where this is affected, if I see what the html looks like I may can help you.

Almost post a screenshot.

Deimos
04-16-2005, 09:39 AM
Works aok for me, not sure if I see much of a difference performance wise

Trigunflame
04-16-2005, 09:40 AM
Works aok for me, not sure if I see much of a difference performance wise

It has more of a bandwidth save than performance :)

If you use this in addition to gzip compression you will save roughly 50-60% in total bandwidth per page.

jcr
04-16-2005, 09:43 AM
Mine does'nt :/

Try uncompress/compress, if that doesn't work, paste the html code of posts where this is affected, if I see what the html looks like I may can help you.

Almost post a screenshot.
Okay hm, I have removed the reputation in the postbit, it is in the memberlist, things looks kinda strange over at my place.

Uncompressing, and then compressing again removed the whitespace between the reputation images :D

The Realist
04-16-2005, 09:46 AM
This latest code does not work for me in IE, the one before worked ok. What Im getting now is my dropdown menues work ok but when I click the New Posts link nothing happens?

Owe well.

Trigunflame
04-16-2005, 09:46 AM
Okay hm, I have removed the reputation in the postbit, it is in the memberlist, things looks kinda strange over at my place.

Uncompressing, and then compressing again removed the whitespace between the reputation images :D

So everythings fine now?

Trigunflame
04-16-2005, 09:48 AM
This latest code does not work for me in IE, the one before worked ok. What Im getting now is my dropdown menues work ok but when I click the New Posts link nothing happens?

Owe well.

Before I was getting massive javascript errors in IE, thats the reason it was changed.

I'll try and contact you, and help you out.

jcr
04-16-2005, 09:52 AM
So everythings fine now?
Superb., just wanted to share the error in case someone meets it later :)

boeserwolf
04-16-2005, 09:57 AM
Nice hack

Klick install

yours

Markus

Trigunflame
04-16-2005, 10:15 AM
Before I was getting massive javascript errors in IE, thats the reason it was changed.

I'll try and contact you, and help you out.

Update;

Contacted; Fixed problem

Notice:

Everyone use the new version, I was replacing tabs with '', which would cause some problems if in links; now its replaced with a single space ' '.

The Realist
04-16-2005, 10:24 AM
Trigunflame is a gent and solved my problem :)

HOTM I say :)
Laters

The Realist
04-16-2005, 10:28 AM
Another problem.

Clicked edit and my page is twice its size?

Not my day?

Trigunflame
04-16-2005, 10:35 AM
Another problem.

Clicked edit and my page is twice its size?

Not my day?

Screenshot :), and again Im not getting this problem on my test forums.

buro9
04-16-2005, 10:36 AM
Had a nice problem relating to the footer template and the inline javascript.

It compressed to:
<script type="text/javascript"><!-- // There was a vbulletin comment here vBulletin_init(); // Initialize 'Active' Table Cells //activecells_init();//--></script>

The problem with that is that // is a line comment, and then there is no line break, so the whole javascript is commented out, and menu's do not get initialised, etc.

The result is that those swishy JavaScript drop down menus break.

You can fix this by updating your footer template to just have:
<script type="text/javascript">vBulletin_init();/script>

In place of the larger block. That does it for me :)

Aside from that minor problem, this hack is wonderful.

I'm going to go off and search for other places that might be impacted by this though... recommendation: Don't compress JavaScript at all... leave line breaks in.

Trigunflame
04-16-2005, 10:38 AM
Had a nice problem relating to the footer template and the inline javascript.

It compressed to:
<script type="text/javascript"><!-- // There was a vbulletin comment here vBulletin_init(); // Initialize 'Active' Table Cells //activecells_init();//--></script>

The problem with that is that // is a line comment, and then there is no line break, so the whole javascript is commented out, and menu's do not get initialised, etc.

The result is that those swishy JavaScript drop down menus break.

You can fix this by updating your footer template to just have:
<script type="text/javascript">vBulletin_init();/script>

In place of the larger block. That does it for me :)

Aside from that minor problem, this hack is wonderful.

I'm going to go off and search for other places that might be impacted by this though... recommendation: Don't compress JavaScript at all... leave line breaks in.

Buro, did you try the new version? Mutli-Line javascript is left in its standard format short of tabs.

ie. using the updated version, my footer looks like this (Compressed Template):

http://narutotalk.org


<script type="text/javascript">
<!--
// Main vBulletin Javascript Initialization
vBulletin_init();
// Initialize 'Active' Table Cells
//activecells_init();
//-->
</script></body> </html>

buro9
04-16-2005, 10:42 AM
Nope, everything else is working fine... editors doing their job, popups where needed are working (attachments, i have a translate hack, buddy list, thread replies, etc).

So just that one very small adjustment... and frankly, for the benefit this hack gives I'd opt for the editing of the footer template over reducing the compression the hack does.

buro9
04-16-2005, 10:43 AM
Buro, did you try the new version? Mutli-Line javascript is left in its standard format short of tabs.

Hehe, maybe not :)

I'll upgrade now :)

buro9
04-16-2005, 10:51 AM
It works, but I had to add a line break.

I'm not sure what version of footer I customised (most likely the vb3 beta one that I've been dragging through each update), but it had the <script block directly following the DST correction block:

</if><script

For some reason that I don't want to look into ;), it would not recognise that as a JS block and was compressing it.

If I moved the <script onto a new line like thus:
</if>
<script

Then it worked perfectly.

As I said though... the footer template is one I modified in vb a long time ago... so this is likely not an issue as viewing the original now shows that they are indeed on new lines already and thus work perfectly.

If anyone has old templates that they've modified though, they hopefully will read this and add the linebreak :)

boeserwolf
04-16-2005, 10:53 AM
Hi

And here is the german translation for all german users:

Trigunflame
04-16-2005, 11:12 AM
Update:

Removed support for inline javascript, all javascript stays line-per-line.
Removed support for inline styles, all style data stays line-per-line.

boeserwolf
04-16-2005, 11:16 AM
Would you please tell me what to change in the code, so that I can change it in the translation too?

Rambo
04-16-2005, 11:18 AM
Hrm,

Here's a little problem with the latest version.

Trigunflame
04-16-2005, 11:26 AM
Hrm,

Here's a little problem with the latest version.

Ok, will try and contact; someone else is having same problem.

Trigunflame
04-16-2005, 12:01 PM
Update:

Im workin on the solution, ive identied the problem as a special template.

Trigunflame
04-16-2005, 12:11 PM
Update;

Finished, everyone use the newest version of the code.

Problem was a certain template that delt with fonts available from drop down menu, they were being compressed also, causing errors.

The Realist
04-16-2005, 12:20 PM
Newest version 2.0 works a treat and congrats to Dusty for his hard work and great skills :)

Thanks M8

Rambo
04-16-2005, 12:46 PM
Working properly now =D.

Thanks for the update, good stuff.

Trigunflame
04-16-2005, 02:09 PM
Working properly now =D.

Thanks for the update, good stuff.

Glad to hear.

boeserwolf
04-16-2005, 03:11 PM
Hi

I also tried it out, and everything works perfect

Thank you

Markus

diettalk
04-16-2005, 03:36 PM
2.0 works here too.

Trigunflame
04-16-2005, 04:08 PM
2.0 works here too.

Good :), hopefully no more patches will need to be added.

msimplay
04-16-2005, 04:19 PM
i've removed the old white space stripper and installed this one instead its given me greater speed gains works good and thumbs up

Trigunflame
04-16-2005, 05:16 PM
i've removed the old white space stripper and installed this one instead its given me greater speed gains works good and thumbs up

That's good to know :)

Corriewf
04-16-2005, 06:07 PM
Nice hack. My forums are so much faster.. GREAT JOB!

detalhe
04-16-2005, 06:32 PM
I installed it but when I have the option to compress templates selected, I get this error on top of my sub-forum pages:

Warning: in_array(): Wrong datatype for second argument in /showthread.php on line 955

Warning: in_array(): Wrong datatype for second argument in /showthread.php on line 955

Warning: in_array(): Wrong datatype for second argument in /showthread.php on line 955

Warning: in_array(): Wrong datatype for second argument in /showthread.php on line 955

Warning: in_array(): Wrong datatype for second argument in /showthread.php on line 1705


If I uncompress everything goes back to normal

:ermm:

Trigunflame
04-17-2005, 12:20 AM
I installed it but when I have the option to compress templates selected, I get this error on top of my sub-forum pages:

Warning: in_array(): Wrong datatype for second argument in /showthread.php on line 955

Warning: in_array(): Wrong datatype for second argument in /showthread.php on line 955

Warning: in_array(): Wrong datatype for second argument in /showthread.php on line 955

Warning: in_array(): Wrong datatype for second argument in /showthread.php on line 955

Warning: in_array(): Wrong datatype for second argument in /showthread.php on line 1705


If I uncompress everything goes back to normal

:ermm:

Create a new style/template set, compress templates and check if you still get the same error; it may be something that you have customized.

vulture
04-17-2005, 12:43 AM
Installed, but this quick hack from vbulletin.com no longer works:

http://www.vbulletin.com/forum/showthread.php?t=101600

Without compress: 1000 new posts
With compress: new posts

The figure just vanishes!

Trigunflame
04-17-2005, 01:00 AM
Installed, but this quick hack from vbulletin.com no longer works:

http://www.vbulletin.com/forum/showthread.php?t=101600

Without compress: 1000 new posts
With compress: new posts

The figure just vanishes!

This was a problem in the earlier version of the hack, make sure you are using the absolute latest version of the code.

IE. Copy what I have up there now, and uncompress/recompress. If you still have a problem, contact me on

AIM: Trigunflame
MSN: Trigunflame@msn.com

Trigunflame
04-17-2005, 01:45 AM
Update:

Everyone should update to latest script if they use php_include, the new version adds php_include_start and php_include_end to the bad templates array.

detalhe
04-17-2005, 09:33 AM
Works great now, thanks!

uae
04-17-2005, 11:35 AM
Works just fine, clicked install :)

Trigunflame
04-17-2005, 11:36 AM
Works just fine, clicked install :)

That's good to know :), vote for Backup Pro while you're at it XD :ninja:

Oblivion Knight
04-17-2005, 12:11 PM
I made the switch from buro9's mod to yours (as per his advise!).

Everything seems to be working perfectly.. :)

Trigunflame
04-17-2005, 01:38 PM
Update, Good News.

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

Support for compressing phrases has been added; this will give additional page compression to certain pages that use multi-line phrases, such as user-cp/faq/ etc..

Also added support to both for removing the ascii \n that some templates/phrases have; give even more compression.

Enjoy !

Trigunflame
04-17-2005, 01:49 PM
Bah Another Update:

Bug reported; Had to add editor_jsoptions_size to the Bad Templates array, it was causing problems selecting font size.

The Realist
04-17-2005, 04:31 PM
Dont know if this is a bug or what but I just received an Email saying a post of mine has been replied to and the email is all crunced up, all the white space has been taken out?

Hello Realist,stevo25 has just replied to a thread you have subscribed to entitled - check out this pi$$take - in the Staff Only forum of xxxxxxxxx Forums.This thread is located at:http://www.xxxxxxxxxx.com/forums/showthread.php?t=xxxx&goto=newpostHere is the message that has just been posted:***************who know plenty of *obs on ebay***************There may be other replies also, but you will not receive any more notifications until you visit the forum again.Yours,TechTronix Forums team~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Unsubscri ption information:To unsubscribe from this thread, please visit this page:http://www.xxxxxxxxxxx.com/forums/subscription.php?do=usub&t=xxxxTo unsubscribe from ALL threads, please visit this page:http://www.tech-tronix.com/forums/subscription.php?do=viewsubscription&folderid=all

Also,

What about a link to uncompress the phrases the same as the templates?

Laters

msimplay
04-17-2005, 04:33 PM
is there no uncompress phrases ?

The Realist
04-17-2005, 04:46 PM
Nope

The Realist
04-17-2005, 04:52 PM
This crunching of the phrases has totally buggered by forums email system up. I have uncompressed the templates as a test and Im still receiving usless crunched up emails so I now know its the phrases.

Now............. how am I going to get out of this?

Trigunflame
04-17-2005, 05:10 PM
This crunching of the phrases has totally buggered by forums email system up. I have uncompressed the templates as a test and Im still receiving usless crunched up emails so I now know its the phrases.

Now............. how am I going to get out of this?

I'll contact you, hold on just a bit; ill make a modification to remove those phrases from being compressed.

Trigunflame
04-17-2005, 05:12 PM
is there no uncompress phrases ?

Im working on it, just hold up a bit.

msimplay
04-17-2005, 05:12 PM
I'll contact you, hold on just a bit; ill make a modification to remove those phrases from being compressed.

any chance of uncompression of the phrases as per the template compression ?

Trigunflame
04-17-2005, 05:19 PM
any chance of uncompression of the phrases as per the template compression ?

The problem was the fact I was removing ASCII \n also, which is used in the phrases dealing with sending emails.

As for uncompress, no; it would require vbulletin hacking adding additional fields to the phrase table. It's a one way deal, but I know which template is the only one affected.

Blam Forumz
04-17-2005, 05:24 PM
Wow, this is getting even better :D Thanks guy

msimplay
04-17-2005, 05:34 PM
The problem was the fact I was removing ASCII \n also, which is used in the phrases dealing with sending emails.

As for uncompress, no; it would require vbulletin hacking adding additional fields to the phrase table. It's a one way deal, but I know which template is the only one affected.

i updated but my emails are still compressed
Lol no wonder you haven't replaced the code with 2.5 version yet :P

Paul M
04-17-2005, 05:47 PM
i updated but my emails are still compressed
Lol no wonder you haven't replaced the code with 2.5 version yet :PYou could restore the phrases from a backup.

Personally I would not touch the phrase compression - too easy to break something - and then hard to restore it, unlike the templates where you just uncompress (restore) them.

Trigunflame
04-17-2005, 05:50 PM
Update:

Its fine paul. It won't happen anymore with the newest version.

--------

Phrase Info:

There was a bug in a version that removed the ASCII \r\n, \r, \n from phrases, and many of these had to do with email.
I have fixed the bug so it won't happen anymore, but for people that were affected I suggest you restore from a backup, or download the
restorePhrases.zip file which will restore your Default English Phrases back to normal; then you can re-run the compression on the phrases.

Step 1. Download restorePhrases.zip
Step 2. Unzip restorePhrases.zip, and place both files in your forum directory
Step 3. Run restorephrases.php from the web like any other php file.
Step 4. You should now have restored the default english phrases, now you can re-compress the phrases again,
(Make absolute sure you are using the latest code, I patched it to not remove \r\n, \r, \n from phrases.)

The Realist
04-17-2005, 05:59 PM
But these restorePhrases.zip file is to restore the whole phrases, what about the phrases needed for install hacks?

The Realist
04-17-2005, 06:03 PM
I Would Recommend To Anyone Not To Compress Your Phrases Like I Did And Buggered Then Up With This Extra Code. Just Keep To The Templates.

A Little Tip.

not a happy chappy but for god sake who ever uses this phrase hack to do a phrase backup first.

msimplay
04-17-2005, 06:19 PM
I Would Recommend To Anyone Not To Compress Your Phrases Like I Did And Buggered Then Up With This Extra Code. Just Keep To The Templates.

A Little Tip.

not a happy chappy but for god sake who ever uses this phrase hack to do a phrase backup first.

Yep i lost a lot of my phrases because of this the phrase portion isn't worth doing unless theres some way to decompress them

Also my my queries have seemed to gone up by 4 queries
my forumhome was 13 queries its now 17
This was due to the phrases portion

Trigunflame
04-17-2005, 06:23 PM
Yep i lost a lot of my phrases because of this the phrase portion isn't worth doing unless theres some way to decompress them

Also my my queries have seemed to gone up by 4 queries
my forumhome was 13 queries its now 17
This was due to the phrases portion

Ya I was iffy about even doing this, but someone contacted me requesting it. It's marked as optional now for future reference.

Edit:

Updated Hack Documentation, Phrase Compression is Purely Optional.

msimplay
04-17-2005, 06:43 PM
Ya I was iffy about even doing this, but someone contacted me requesting it. It's marked as optional now for future reference.

Edit:

Updated Hack Documentation, Phrase Compression is Purely Optional.

Can u please help me decompress the phrases as my queries have gone up and some of my phrases won't show up even though they are there

Trigunflame
04-17-2005, 06:46 PM
Can u please help me decompress the phrases as my queries have gone up and some of my phrases won't show up even though they are there

Use the instructions at the bottom of the main post. It will restore all of your default templates.

Oblivion Knight
04-17-2005, 07:24 PM
Thank god I had recent-ish database backups.. Just used the phrase table. :p

Trigunflame
04-17-2005, 07:32 PM
Thank god I had recent-ish database backups.. Just used the phrase table. :p

Ya I removed phrase compression altogether now, I don't want to risk other people messing their forums up.

The Realist
04-17-2005, 08:31 PM
This is the best option M8.

Ya I removed phrase compression altogether now, I don't want to risk other people messing their forums up.

Trigunflame
04-17-2005, 08:59 PM
lol after what ive had to go through with that, i would agree XD

T3MEDIA
04-18-2005, 10:44 AM
May I be honest?

Is this worth the "riga-a-m0n-row"?
Does it compress that good?

Paul M
04-18-2005, 10:53 AM
Is this worth the "riga-a-m0n-row"?huh ? Can you translate this into english please :)

Trigunflame
04-18-2005, 11:11 AM
May I be honest?

Is this worth the "riga-a-m0n-row"?
Does it compress that good?

I removed phrase compression, there is no "riga-a-mon-row" to go through anymore.

Trigunflame
04-18-2005, 12:24 PM
update;

ability to strip HTML Comments.

diettalk
04-18-2005, 03:16 PM
Installed.. vb puts a lot of "html comments" in, that really aren't needed, unless your diagnosing a problem.

msimplay
04-18-2005, 03:27 PM
does anyone have a copy of version 2.6 the one before the strip whitespace its causing some problems for me

Corriewf
04-18-2005, 03:28 PM
I think that this is a GREAT hack that should of been released in the beta section first though. I installed the version right before the phrase goof and im very happy with the results, but I feel that with the discovery of additional optimization tools that this could actually be called Vbulletin optimization wizard.
Great hack :)

Paul M
04-18-2005, 03:36 PM
It's getting a bit out of hand now, I'm going to click uninstall for now - too many updates every day.

How can the effects of these changes possibly be properly tested and judged.

Trigunflame
04-18-2005, 03:40 PM
It's getting a bit out of hand now, I'm going to click uninstall for now - too many updates every day.

How can the effects of these changes possibly be properly tested and judged.

phrase support was removed, there really is nothing left to update.

Paul M
04-18-2005, 04:06 PM
Sorry, but I can't consider something that has changed 19 times in less than 4 days as even remotely stable - you have added things and then removed them when they break peoples boards - you have removed stuff and then added it back in the next release. How can anyone possibly keep up.

You don't even provide it as a downloadable text file, which makes it harder to install anyway.

I have had an e-mail for updates every day since I installed a version (god knows which one now) by the time I saw todays e-mail and got here, you had done two releases. Sorry but I just can't keep up with it.

Maybe in a month or so when it's calmed down, and available as a text file.

Trigunflame
04-18-2005, 04:07 PM
does anyone have a copy of version 2.6 the one before the strip whitespace its causing some problems for me

Note:

Was fixed by adding particular template he had from hacks to bad templates array.

Trigunflame
04-18-2005, 04:10 PM
Sorry, but I can't consider something that has changed 19 times in less than 4 days as even remotely stable - you have added things and then removed them when they break peoples boards - you have removed stuff and then added it back in the next release. How can anyone possibly keep up.

You don't even provide it as a downloadable text file, which makes it harder to install anyway.

I have had an e-mail for updates every day since I installed a version (god knows which one now) by the time I saw todays e-mail and got here, you had done two releases. Sorry but I just can't keep up with it.

Maybe in a month or so when it's calmed down, and available as a text file.

Maybe, in the future I will wait 6 months before I fix something *sarcasm*

Paul M
04-18-2005, 05:36 PM
Maybe, in the future I will wait 6 months before I fix something *sarcasm*Right ...............

CommunityZ
04-19-2005, 01:53 AM
Can i install your hacks after i install https://vborg.vbsupport.ru/showthread.php?t=69787&page=7&pp=15 buro9 hack

Trigunflame
04-19-2005, 12:00 PM
Can i install your hacks after i install https://vborg.vbsupport.ru/showthread.php?t=69787&page=7&pp=15 buro9 hack

Really would be no point. Just install mine.

buro9
04-19-2005, 07:36 PM
Really would be no point. Just install mine.
I'm buro9, and I agree with Trigunflame... which is why my hack features a link back to this one.

The only reason mine has more installs is that it has been available longer, but this hack is better in that it spares processing power by compressing the templates once and not every page every time.

You don't need to install both.

If you want the better of the two, go for this one.
If you want one that has changed in a while, by all means go for mine... but in a months time when this one hasn't changed again (it had intense development and I probably linked to it too soon) you should consider moving to this one.

:)

Trigunflame
04-19-2005, 07:57 PM
I'm buro9, and I agree with Trigunflame... which is why my hack features a link back to this one.

The only reason mine has more installs is that it has been available longer, but this hack is better in that it spares processing power by compressing the templates once and not every page every time.

You don't need to install both.

If you want the better of the two, go for this one.
If you want one that has changed in a while, by all means go for mine... but in a months time when this one hasn't changed again (it had intense development and I probably linked to it too soon) you should consider moving to this one.

:)

ya, hopefully *no more development*

far as im concerned, it's done.

TTG
04-19-2005, 09:39 PM
Works on 3.0.6 with loads of hacks and had no problems.

Great hack.

Clicked install :)

kall
04-19-2005, 10:25 PM
ya, hopefully *no more development*

far as im concerned, it's done.
I *does* continually screw over certain templates still..I have to save my forumhome_loggedinusers template each time I accidentally compress templates, otherwise it parses stuff a bit bodgily.

Trigunflame
04-20-2005, 12:21 AM
I *does* continually screw over certain templates still..I have to save my forumhome_loggedinusers template each time I accidentally compress templates, otherwise it parses stuff a bit bodgily.

The bad templates array exist for a reason, add the offending templates to the array and it will skip them.

msimplay
04-20-2005, 06:08 AM
The bad templates array exist for a reason, add the offending templates to the array and it will skip them.

would be good if a list of bad templates could be added here

The Realist
04-20-2005, 09:06 AM
What I've noticed on my forums is all my avatars and picture attachments have gone a bit hay wire.

I now have to re-upload them as they are all buggered :)

Laters

MentaL
04-20-2005, 10:48 AM
Worth using on ragezone.com or will i get just tons of errors?

Trigunflame
04-20-2005, 12:15 PM
Worth using on ragezone.com or will i get just tons of errors?

It is all reversible, the above person unfortunately has no idea what he is talking about; as this mod "only" modifies templates; and has no effects on attachments or avatars.

Blam Forumz
04-21-2005, 03:08 PM
Worth using on ragezone.com or will i get just tons of errors?
its worth it. definately

MentaL
04-21-2005, 03:22 PM
Installed.........


And DAMN.. its 3 times faster ^__^

http://forum.ragezone.com

lazytown
04-26-2005, 07:49 PM
First, Thank you for this hack. I think the idea is great.

However, I am having a minor problem. Some items (like in vbGarage 4.1.0) are not appearing the same as they did before. For example, a series of thumnbail photos used to wrap, and with the templates compressed they no longer wrap, which causes the user to have to horizontally scroll their browser.

I looked at the html before and after compression, and it appears that there was originally a series of spaces in between each <img> tag. With the spaces removed, IE will not allow them to wrap to the next line. Can the program just remove spaces after the first one? That way it is still compressing but not removing possibly necessary spaces.

Thanks
-V

Trigunflame
04-26-2005, 08:45 PM
First, Thank you for this hack. I think the idea is great.

However, I am having a minor problem. Some items (like in vbGarage 4.1.0) are not appearing the same as they did before. For example, a series of thumnbail photos used to wrap, and with the templates compressed they no longer wrap, which causes the user to have to horizontally scroll their browser.

I looked at the html before and after compression, and it appears that there was originally a series of spaces in between each <img> tag. With the spaces removed, IE will not allow them to wrap to the next line. Can the program just remove spaces after the first one? That way it is still compressing but not removing possibly necessary spaces.

Thanks
-V

Change

$search = array('/\s+/', '/\t+/');

To

$search = array('/\s\s+/', '/\t+/');

Does it work now?

Oblivion Knight
04-28-2005, 06:23 PM
I finally got around to updating to 2.8 from 2.6 - so far, so good.

Relieved to see that the updates have calmed down somewhat.. ;)

Lizard King
04-28-2005, 10:07 PM
Installed 5 minutes ago and working pretty good...

Oblivion Knight
05-01-2005, 01:24 PM
Change

$search = array('/\s+/', '/\t+/');

To

$search = array('/\s\s+/', '/\t+/');

Does it work now?Even with the suggested fix, there does appear to be a slight issue with it taking away spaces that it shouldn't from a design point of view..

I noticed this one earlier this morning when I was fixing various bugs on my forum.

Trigunflame
05-01-2005, 10:17 PM
Even with the suggested fix, there does appear to be a slight issue with it taking away spaces that it shouldn't from a design point of view..

I noticed this one earlier this morning when I was fixing various bugs on my forum.

try using just

$search = array('/\s\s+/');

for some reason vbulletin uses tabs in various places.. that could be the problem..

laeth
05-02-2005, 06:42 AM
Heya,

Cool hack, but when I compress the templates all my links become underlined, when they are not supposed tobe. Any ideas?

Oblivion Knight
05-02-2005, 07:06 AM
try using just

$search = array('/\s\s+/');

for some reason vbulletin uses tabs in various places.. that could be the problem..Nope, that isn't the problem.. :nervous:

LambHyjoo
05-10-2005, 02:05 PM
I am worried by the "needed spaces" (for design, which should be replaced by some "&nbsp;") too. How did you manage your spaces problems, vissa ? Did you have to replace all the spaces by "&nbsp;" ? Or the Trigunflame tip made the work for you ?

But this hack seems definitely to be useful. I'll keep in touch with this thread.

mutus123
05-14-2005, 03:15 PM
This reduced the file size of my showthread page by nearly 20% :up:

Definitely speeds things up too.

Thank you!

dutchbb
05-15-2005, 02:58 PM
How can I apply this to only certain (payed) usergroups?

4number8
05-15-2005, 05:36 PM
Installed and works great, I can see a nice increase in page loading...many thanks :)

Trigunflame
05-16-2005, 04:56 PM
I am worried by the "needed spaces" (for design, which should be replaced by some "&nbsp;") too. How did you manage your spaces problems, vissa ? Did you have to replace all the spaces by "&nbsp;" ? Or the Trigunflame tip made the work for you ?

But this hack seems definitely to be useful. I'll keep in touch with this thread.

Sorry, Ive been away for a while. I will try to fix this problem ASAP.

Trigunflame
05-16-2005, 04:57 PM
How can I apply this to only certain (payed) usergroups?

I don't quite understand the need for this?

dutchbb
05-16-2005, 06:26 PM
I don't quite understand the need for this?
Does this hack make the board run faster? So members in that usergroup can browse faster... Or is it only saving bandwith?

Trigunflame
05-16-2005, 06:54 PM
Does this hack make the board run faster? So members in that usergroup can browse faster... Or is it only saving bandwith?

This is to be applied to your forum as whole, controlled by you in the admin control panel.

This hack compresses your templates, thus saving you bandwidth while Also speeding up your forums a good bit on large pages.

diettalk
05-17-2005, 12:02 PM
How about optimizing the "archive"?

Zero Tolerance
05-18-2005, 04:57 AM
How about optimizing the "archive"?
The Archive loads with such speed and uses very little HTML i doubt compressing it would actually make much of a difference really.

Also good work Trigunflame, i'm going to install this now and compare the loading times and see how well this works :)

- Zero Tolerance

lazytown
05-18-2005, 10:19 AM
The Trigunflame seemed to work for my problems. I believe it always leaves the first space now (which solves design formatting problems).

-V

I am worried by the "needed spaces" (for design, which should be replaced by some "&nbsp;") too. How did you manage your spaces problems, vissa ? Did you have to replace all the spaces by "&nbsp;" ? Or the Trigunflame tip made the work for you ?

But this hack seems definitely to be useful. I'll keep in touch with this thread.

Spinball
05-20-2005, 08:17 PM
Got a problem with the forum home when compressing templates.
See the attached screen grabs.
The first is a grab after templates have been compressed. And the second is when they are not compressed.
Note that the number of users visiting is missing a space before it.
What do I do to fix this, please?

aranthorn
05-25-2005, 05:52 PM
installed (yes, I clicked the install button) and thanks. My bandwidth has been going through the roof over the past month with a big influx of members, this can't hurt. I'll have to give it a couple days and look at the raw numbers, when I get some results I will post some feedback :D

Andreas
05-30-2005, 05:12 PM
Nice hack.
Just wanted to point out that Zero Tolerance was not the first one who had this idea (https://vborg.vbsupport.ru/showpost.php?p=464312&postcount=8) ;)

One suggestion:
Add an option to let the admin decided if Templates should be automatically compressed when saving them.
This way one could edit templates without always having to re-do the compression :)

PIKenPIK
05-31-2005, 10:17 AM
w00t .............. forum goes like a rocket :lick: :lick: :lick: :lick: :lick: :lick:

Big HUGGGG :banana:

//edit:
one small Q:
The bad templates array exist for a reason, add the offending templates to the array and it will skip them.
I've done the compression & everything seems to work like a a charm.

Compress Templates and Uncompress Templates seems for me the only 2 options in the ACP ..
Is there only a bad templates array when there is a bad template?
Or where can i find this array?

LambHyjoo
06-02-2005, 07:47 AM
I forgot to post my opinion on this hack : Very good job ! :D

I had little problems with some custom templates I did, but it was tuned in less an hour.

Thanks again !

PIKenPIK
06-02-2005, 07:58 AM
I forgot to post my opinion on this hack : Very good job ! :D

I had little problems with some custom templates I did, but it was tuned in less an hour.

Thanks again !
So, you can give me an answer to my question? :ninja:

Marco van Herwaarden
06-02-2005, 08:12 AM
In admincp/template.php:
// List of Templates to NOT Compress
$badTemplates = array(
'editor_jsoptions_font',
'editor_jsoptions_size',
'phpinclude_start',
'phpinclude_end'
);

smacklan
06-02-2005, 10:01 PM
What a freakin awesome hack...I'm running 2 to 3 times faster!!! Installed without any ill effects as far as I can tell ( at least none that I can't live with)! Thanks dude!

LuBi
06-09-2005, 02:45 AM
worked fine for me on a very modded and styled board.. no issues I can see at all..? nice release. thanks.

kthlnwrnr
07-14-2005, 07:00 AM
Does this hack work with VB 3.3?
I tried insalling it but I guess I am doing something wrong. I get an internal server error everytime I click on the compress link.

There is a chance that I am doing one thing wrong. In step to the instruction says I should [ Go to about line: 1278, or just look for $_REQUEST['do'] == 'edit' ]


Now should I paste the codes right above $_REQUEST['do'] == 'edit')

or right above if ($_REQUEST['do'] == 'edit')
Or right above (This is line 1278 in my template.php)//################################################## ###########################
// edit form for an existing template
if ($_REQUEST['do'] == 'edit')

?

I apologize in advance for my ignorance, but I am a bit confused and would like to get this hack to work.

Prodimysterio
08-03-2005, 07:17 PM
worked fine for me on a very modded and styled board.. no issues I can see at all..? nice release. thanks.

Same here. Thanks for the great modification.

:)

loftyasianz
08-12-2005, 07:12 PM
thanks for this awesome hack. it really seems like a good idea.

i just finished installing this and i compressed my templates. but when i refreshed my page, i got this
Parse error: parse error, unexpected ',' in /home/gm0nk3y/public_html/forums/index.php(672) : eval()'d code on line 1

any suggestions? it was all fixed when i uncompressed the templates.

thanks in advance,
warren

gbechtel
08-29-2005, 04:05 AM
Installed & woking on masscops.com with no problems at all! Excelent job, thanks...

stan111
09-14-2005, 06:59 AM
damn, this works like a champ
my board is heavily modified and i dont have any experience in coding or anything
i mod it and it works at the first time. my board load so fast now

thanks a million for writting this code

edit: i just check my board again, and somehow, my quickreply text box disappeared :nervous:
anyone know wat happen ?

stan111
09-14-2005, 07:13 AM
above it, i did that and it works

//################################################## ###########################
// edit form for an existing template
if ($_REQUEST['do'] == 'edit')

Andreas
09-14-2005, 07:31 AM
Any chance for a 3.5 Version?

stan111
09-15-2005, 06:20 AM
edit: i just check my board again, and somehow, my quickreply text box disappeared :nervous:
anyone know wat happen ?

anyone ?

buro9
09-15-2005, 07:10 AM
Any chance for a 3.5 Version?

It's really simple to migrate.

Just copy the block of code into the foot of admincp/template.php

And then add this XML to includes/xml/cpnav_vbulletin.xml

<navoption comment="HACK : COMPRESS TEMPLATES" displayorder="51">
<phrase>compressall</phrase>
<link>template.php?do=compressall</link>
</navoption>

<navoption link="template.php?do=compressall&amp;revert=1" comment="HACK : COMPRESS TEMPLATES" displayorder="52">
<phrase>uncompressall</phrase>
</navoption>



That needs to go ABOVE this piece:

</navgroup>

<navgroup phrase="languages_and_phrases" permissions="canadminlanguages" displayorder="30">



Which places it in the styles_and_templates group.

The hack continues to work perfectly in vb3.5 :)

buro9
09-15-2005, 07:11 AM
Oh, and I added the 'comment' attribute as I like being able to search the whole code base and see instantly what modifications I need to migrate at update time by simply looking for the word HACK. :)

hidjra
10-05-2005, 04:42 PM
It's really simple to migrate.

Just copy the block of code into the foot of admincp/template.php

And then add this XML to includes/xml/cpnav_vbulletin.xml

<navoption comment="HACK : COMPRESS TEMPLATES" displayorder="51">
<phrase>compressall</phrase>
<link>template.php?do=compressall</link>
</navoption>

<navoption link="template.php?do=compressall&amp;revert=1" comment="HACK : COMPRESS TEMPLATES" displayorder="52">
<phrase>uncompressall</phrase>
</navoption>



That needs to go ABOVE this piece:

</navgroup>

<navgroup phrase="languages_and_phrases" permissions="canadminlanguages" displayorder="30">



Which places it in the styles_and_templates group.

The hack continues to work perfectly in vb3.5 :)

This won't work. You'll need to change the queries to:
if it's a select/read querie:
from '$DB_site->query' to '$db->query_read'

if it's a update/write querie:
from '$DB_site->query' to '$db->query_write'

You also need to add the phrases 'compressall' and 'uncompressall'. otherwise they won't show up in de navigation-menu of your adminCP.

You can also remove the badtemplates 'phpinclude_start' and 'phpinclude_end'. They don't exist in vb3.5 gold


Hidjra

stan111
10-13-2005, 10:05 AM
this mod rocks, i luv it so much, it speeds up the forum like crazy
but does anyone here have the same problem like me after you compress the template, your text message box disappears. Here is a pic of my quick reply after the template compression
https://vborg.vbsupport.ru/

buro9
10-13-2005, 10:15 AM
this mod rocks, i luv it so much, it speeds up the forum like crazy
but does anyone here have the same problem like me after you compress the template, your text message box disappears. Here is a pic of my quick reply after the template compression
http://img411.imageshack.us/img411/7736/untitled7lo.jpg

Nope... don't have that at all.

Have you hacked that template though? Put anything in there that might make it less than rock solid (stacks of JavaScript and weird HTML for example?).

You can just figure out what the template name for that is and add it to the array of templates to skip. However it shouldn't be an issue, figure out where you've broken it and fix that would be the better solution :)

buro9
10-13-2005, 10:16 AM
Oh... and an example of the before and after HTML would be appreciated... at least we'd be able to understand what went wrong then.

mutus123
10-15-2005, 04:18 PM
Piecing together instructions of both buro9 and hidjra, I was able to install this for 3.5.

I hope it's not wrong of me to do this but I went ahead and updated the text file instructions for 3.5.

This is a great hack, again many thanks.

Edit: Text file removed, as I discovered what I did is frowned upon here.

buro9
10-15-2005, 06:28 PM
Piecing together instructions of both buro9 and hidjra, I was able to install this for 3.5.

I hope it's not wrong of me to do this but I went ahead and updated the text file instructions for 3.5, as the current installation file is obsolete. I'm posting it here to maybe help some others.

This is a great hack, again many thanks.

To be fair, the 3.5 install is virtually identical to the 3.0 install ;)

The only real difference is adding the elements to the admincp.

I'm sure most of us simply upgraded manually ;) Though I'm also sure that your file will be very appreciated by those who would prefer a fuller set of instructions :)

mutus123
10-15-2005, 08:14 PM
To be fair, the 3.5 install is virtually identical to the 3.0 install ;)

The only real difference is adding the elements to the admincp.

I'm sure most of us simply upgraded manually ;) Though I'm also sure that your file will be very appreciated by those who would prefer a fuller set of instructions :)

Understood. I realize this particular hack is for 3.0.x, therefor the install file is perfectly fine. I meant no offense.

But it won't work for 3.5, so I just thought it may help a few people to outline the process of making this work in 3.5. It's not a big deal, but like you said, many prefer a full set of instructions, and are not always confident in manipulating code, nor able to solve a problem when an error occurs. So I just combined yours and hidjra's instructions.

Cheers and thank you again for this wonderful hack :)

buro9
10-16-2005, 08:22 AM
Cheers and thank you again for this wonderful hack :)

Oh, it's not mine, it's Trigunflames. Next time I see him on messenger I'm gonna bug him to re-package for 3.5. The live compress hack out there needs to be taken down by this one... this one is just so much more efficient (less overhead as you only do when you change things, not on every page hit).

stan111
10-16-2005, 11:04 PM
thanks a lot , buro9
i have template mod like background picture in the quick reply text message area
https://vborg.vbsupport.ru/showthread.php?t=42803&page=1&highlight=background+quickreply

i dont know if this would make it disappear

buro9
10-17-2005, 07:10 AM
thanks a lot , buro9
i have template mod like background picture in the quick reply text message area
https://vborg.vbsupport.ru/showthread.php?t=42803&page=1&highlight=background+quickreply

i dont know if this would make it disappear

It's very likely.

I can't see the source code of the template to be able to see what it might do. The hack you linked to is very old and the original zip file attached to that thread is no longer there.

I would suggest that you either add this template to the array of bad_templates so that it doesn't get compressed (everything else still will), or that you uninstall that hack or revert the template.

stan111
10-17-2005, 07:56 AM
thanks again for a fast reply, buro9
i added too many hacks and now i have no idea how to uninstall that
so would you please show me how to add that template to array of bad_templates ?

buro9
10-17-2005, 08:01 AM
thanks again for a fast reply, buro9
i added too many hacks and now i have no idea how to uninstall that
so would you please show me how to add that template to array of bad_templates ?

Just take the name of the template that is breaking, and find this piece of code in the compression hack above:

$badTemplates = array(
'editor_jsoptions_font',
'editor_jsoptions_size',
'phpinclude_start',
'phpinclude_end'
);

Simply add the name of the template that is causing problems to that array... which means adding a line like this at the end of the array (but within the brackets):

,'templateName'


And then upload and re-run the admincp thingy and it will skip compressing that template.

Oh, one more thing... if you have already applied the hack and it is still broken, uncompress the templates, apply this change, and the re-compress the templates :)

stan111
10-17-2005, 08:03 AM
omg, u r so fast, man
you rock
thanks a ton
let me go try that now

stan111
10-17-2005, 08:15 AM
yeah, it works like a champ
it skips that template, now my forum going way faster
thanks a million for all your help, buro9

buro9
10-17-2005, 08:32 AM
yeah, it works like a champ
it skips that template, now my forum going way faster
thanks a million for all your help, buro9

It could go even faster if you did two things:

Move your stylesheets to files. The option for this is in the AdminCP.
Much more time consuming... validate your pages with the W3C Validation service: http://validator.w3.org/check?uri=http%3A%2F%2Fwww.lonelyviet.com%2F
Currently your pages are not coming back XHTML Transitional compliant, in fact on your home page there were 653 errors (probably only 20 or 30 things in actual templates). The cleaner your HTML is, the faster a browser will render it. Force the browser to have to deal with your errors, and it will slow down as it has to spend time trying to guess what you want.

vBulletin ships valid XHTML Transitional code... so it's just up to you to make sure when you hack it that things are still cool.

Examples:
Close your tags: <p> should always have an end </p>, <img> should always have a self-closing slash <img />.

Include required attributes: <script> has to have a type: <script type="text/javascript">

Comment out your JavaScript for non-capable browsers: <script type="text/javascript"><!--
function boo() {alert('boo');}
// --></script>

Lots of TR tags are missing.

Etc, etc.

If your HTML is clean, it will render much faster as the browsers job is much easier.

stan111
10-17-2005, 12:50 PM
i didn't know that i got that many errors on my page. i keep wondering why my homepage load so damn slow
thanks a lot for showing me all of those stuffs, buro9
that will be my next project
:up: buro9

Wisch
10-20-2005, 12:45 AM
Awesome, optimized my forums, no errors, very smooth and efficient as always but with a noticable loading speed increase.
Thanks / *INSTALLED*

kzap
11-13-2005, 01:44 AM
can anyone convert this into a xml plugin for 3.5?

Anyway just to add to the others who posted instructions to install on vb3.5

1.) https://vborg.vbsupport.ru/showpost.php?p=773582&postcount=165

2.) https://vborg.vbsupport.ru/showpost.php?p=787240&postcount=167

3.) add the code above
// ################################################## ###########################
// form to edit a style
if ($_REQUEST['do'] == 'editstyle')

4.) Replace $DB_site->fetch_array with $db->fetch_array

That should do it, works like a charm :)

mutus123
11-13-2005, 12:06 PM
can anyone convert this into a xml plugin for 3.5?

I have it installed on my 3.5.1 as a stand-alone product (no file edits).

I offered to either release it or give it to the original author to release, but got no response.

buro9
11-14-2005, 07:38 AM
I offered to either release it or give it to the original author to release, but got no response.

I have him in trillian, I'll ask for you :)

noj75
12-14-2005, 10:20 AM
Hi all,

I have 3.5.2 but the area thats requires this edit:
construct_nav_option($vbphrase['find_updated_templates'], 'template.php?do=findupdates', '<br />');

actually reads like this in my admincp/index.php
construct_nav_option($navoption['text'], $navoption['link']);

Any ideas where i have to place this addition of code?
construct_nav_option("Compress Templates", 'template.php?do=compressall', '<br />');
construct_nav_option("Uncompress Templates", 'template.php?do=compressall&revert=1', '<br />');

Best regards

T3MEDIA
02-04-2006, 01:25 PM
wow this really really works. Nice. Real nice.

Trigunflame
02-04-2006, 02:12 PM
I have it installed on my 3.5.1 as a stand-alone product (no file edits).

I offered to either release it or give it to the original author to release, but got no response.

Im finally back from my hiatus and play to fix a lot of the bugs and release some stuff again.

Ill try to wokr on whatever I can today and tomorrow; im working on the backup system right now.

Trigunflame
02-04-2006, 02:30 PM
wow this really really works. Nice. Real nice.

You just now tried it ......... lol :ninja: think i made this many months ago