1
iLuc
Trick [SMARTY] Compress your code HTML
  • 2012/3/13 1:35

  • iLuc

  • Just popping in

  • Posts: 47

  • Since: 2009/6/6 0


Good evening,

The trick lies below.


Note to developers: I am looking for a solution to improve this trick. To make it more efficient. (See below) may be, it can be integrated into a future version of Xoops?

This technique is used by Prestashop and other CMS.
What makes the time postings Lots more powerful.
Which is very good for SEO.

It must be possible to compress the HTML before recording cached. (Compiled file)

Thank you for your help.

ps: Excuse me, I not write English very well.

iLuc ( a French user )

2
iLuc
Re: [SMARTY] install
  • 2012/3/13 1:48

  • iLuc

  • Just popping in

  • Posts: 47

  • Since: 2009/6/6 0


i'm So,

it works!

in header.php

line 119

add this code :

$xoopsTpl =& $xoTheme->template;
    
$xoopsTpl->load_filter('output''trimwhitespace');



To remove the line breaks.

in the file : outputfilter.trimwhitespace.php

/class/smarty/plugins/outputfilter.trimwhitespace.php

add this code on line 93:

$source trim(preg_replace("/(rn|n|r)/"""$source));
$source =  trim(preg_replace("//i""
"
$source));
$source trim(preg_replace('##','',$source));




Your HTML code is compressed !

In action here ---> Disques vinyles
And also here ---> Petites annonces


Very Good for page speed and SEO !!

This allowed me to achieve a score of 97 out of 100,
on Page Speed ​​Online (Google) for the site : Limonads.com


Luc ( A French User )




-

3
iLuc
Re: Trick [SMARTY] Compress your code HTML
  • 2012/3/13 5:03

  • iLuc

  • Just popping in

  • Posts: 47

  • Since: 2009/6/6 0


Compression code, thus between the compiled file and display.
I would like compression, before saving the file compiled.

What I can do with an instalation SMARTY (Not Xoops)

Any idea?

This will allow a great improvement in Xoops, for performance!

Files in Cache (compilation) will be compressed.
And therefore, the display time of Xoops, more powerful! ...

Prestashop uses this technique.

Thank you for your help.


iLuc

4
rgauci
Re: Trick [SMARTY] Compress your code HTML
  • 2012/3/13 7:01

  • rgauci

  • Not too shy to talk

  • Posts: 173

  • Since: 2007/8/31


Hi iLuc

I am impressed and would like to implement this and try it out.
Would you be king enought to tells how to get the code and step by step where to put them in the xoops directory

Thanks again I think your site is pretty fast
Ray
Be Set FREE!

5
iLuc
Re: Trick [SMARTY] Compress your code HTML
  • 2012/3/13 7:21

  • iLuc

  • Just popping in

  • Posts: 47

  • Since: 2009/6/6 0


Hi, thank ! ;)

in file : header.php

After this code :
$xoopsTpl =& $xoTheme->template;


Add this code :
$xoopsTpl->load_filter('output''trimwhitespace');



Then..

Open this file :
/class/smarty/plugins/outputfilter.trimwhitespace.php

After this code :
$source trim(preg_replace('/((?)n)[s]+/m''1'$source));


Add this code :
$source trim(preg_replace("/(rn|n|r)/"""$source));
$source =  trim(preg_replace("//i""
"
$source));
$source trim(preg_replace('##','',$source));



If someone helps me to solve the problem. (Post above).
The display time will be even faster!

I hope we will find the solution.

Exactly would require that the compiled code is compressed before the file is saved in cache...

it would be the Best!


-

6
Mamba
Re: Trick [SMARTY] Compress your code HTML
  • 2012/3/13 8:16

  • Mamba

  • Moderator

  • Posts: 11412

  • Since: 2004/4/23


Quote:
Exactly would require that the compiled code is compressed before the file is saved in cache...

I saw in this article that:

Quote:
PrestaShop takes the hard work out of combining, compressing and caching CSS and JavaScript by doing it all for you. It has the option to combine all external CSS files into a single CSS file and all external JavaScript files into a single JavaScript file. There is an option to compress inline JavaScript in HTML too. PrestaShop uses Douglas Crockford's JSMin Javascript minified ported to PHP by Ryan Grove for its compression and Smarty to cache the combined, compressed file.

If somebody could implement it in XOOPS, it would be very cool

There is also this article with optimization tips.
Support XOOPS => DONATE
Use 2.5.11 | Docs | Modules | Bugs

7
iLuc
Re: Trick [SMARTY] Compress your code HTML
  • 2012/3/13 8:27

  • iLuc

  • Just popping in

  • Posts: 47

  • Since: 2009/6/6 0


Hi Manba !

Yes, there it would be the best of the best! ...

But here, the compilation CSS, JS ... I would find it difficult to help.
Should consider and understand Prestashop.
I think they wrote their own code.

While the trick that I propose to above is based on Smarty Plugin.
Which is already in Xoops.

Good day! :)

8
iLuc
Re: Trick [SMARTY] Compress your code HTML
  • 2012/3/13 8:30

  • iLuc

  • Just popping in

  • Posts: 47

  • Since: 2009/6/6 0


Oupss ..

I had not seen, there was the script!
It's good, that! ... :)

I take a look...

9
iLuc
Re: Trick [SMARTY] Compress your code HTML
  • 2012/3/13 8:47

  • iLuc

  • Just popping in

  • Posts: 47

  • Since: 2009/6/6 0


I found another track to cache the JS file, and compress.

Smarty compress javascript

And or minified CSS : CSS min

10
rgauci
Re: Trick [SMARTY] Compress your code HTML
  • 2012/3/13 9:03

  • rgauci

  • Not too shy to talk

  • Posts: 173

  • Since: 2007/8/31


an follow that...but

is this the file scipt that one needs to download called Smarty-3.1.8. In this package there are 2 folders, one called libs and the other called demo
in the libs and in the libs folder there are more, plugings and sysplugins where the file outputfilter.trimwhitespace.php resides

do one needs to install this Smarty folder in the root system

Advise please
Be Set FREE!

Login

Who's Online

147 user(s) are online (102 user(s) are browsing Support Forums)


Members: 0


Guests: 147


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Dec 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits