PDA

View Full Version : HowTo compressed html code for better page speed



Steffen Buschkemper
April 21, 2013, 07:26 PM
Hi @ All

To compress the html code and optimize the loading time of the pages makes the following change
Go to folder libs -> smarty and open Smarty_Compiler.class.php

Find the follow code @ line ~ 426



$compiled_content = $template_header . $compiled_content;


Above this code paste following lines



$compiled_content = trim(preg_replace('/((?<!\?>)\n)[\s]+/m', '\1', $compiled_content));
$compiled_content = preg_replace('#<!--//.*?-->#s', '', $compiled_content);
$compiled_content = preg_replace("#>(\s+)<#s", "><", $compiled_content);


Save and Close.

Now go via ftp to Folder tmp -> compile and delete all php files.
Please do not delete the .htaccess file!

OK login to admin panel and go to Common -> Refresh.
Press all Buttons -> Recount, Rearrange, Update and Update.


Now the pages are created with compressed html code.
Thats all...


Best regards
Steffen

Pete Young
April 21, 2013, 11:06 PM
A lot of goodness being shared here, thank you.

Viktor
April 22, 2013, 03:33 AM
Hello Steffen,

Would you please explain me what is better after compressed html?
html size less 5-10Kb or more or what? explain to me and other people please. :)

Steffen Buschkemper
April 22, 2013, 04:09 AM
Hello Viktor,

If many visitors visit a page, the traffic will be higher.
It all adds up. Any reduction reduces traffic.
Slightly better page speed also there is the further.

It is still not optimal.
Have also tried javascript to compress, but that resulted in problems.

Best regards
Steffen

Morgan Bohman
April 22, 2013, 05:44 AM
Hi all,
I'm using Google Page Speed which could be a plugin for Flynax if they find it interesting or your host as it is an open-source Apache HTTP server module. It will reduce load and makes your page run faster. I have the ability to use also static and dynamic cacher but Google Page Speed is far better.
I provide you with a very useful link where you also can read about it -->https://developers.google.com/speed/pagespeed/mod

//Morgan

Ionut Barabasa
August 4, 2013, 09:07 PM
Thank you Steffen Buschkemper . Good advice

rosegarden
October 20, 2013, 04:51 AM
Thank you Steffen Buschkemper . Good advice

Hi Steffen
Did you do anything Javascript parsing?

http://www.flynax.com/forum/showthread.php?1633-Defer-parsing-of-JavaScript-Improve-Homepage-loading-speed&p=7155#post7155

Anderson Camargo
August 31, 2017, 07:30 PM
thanks for sharing

Ionut Barabasa
September 2, 2017, 09:19 PM
Thank you for this information. It worked. In Pagespeed Insight i had a recommendation to reduce the size of HTMl and now that disappeared

Ionut Barabasa
September 3, 2017, 02:27 PM
I must share this info with those who have multi language site.This improvement will work nice with one language site but in multilanguage in Admin area when editing a listing everything will be a mess.All langauges form will apear one under another and will not be like before when changed pressing the tab.