| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Smarty.php Mod to Remove all UN-NECESSARY White Space | ||||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Smarty.php Mod to Remove all UN-NECESSARY White Space
Smarty has an included filter that you can implement quite simply by adding one line of code to your SMARTY.PHP file.
Add the following line to the file just below the ImagesDir and SkinDir assign statements near the end: Code:
It safely removes all whitespace from the generated HTML just prior to sending the page to the client - increases speed dramatically by reducing the overall size of the file. It works great and you will have no more un-necessary blank lines or spaces. Check it out before and after by using View, Source in your browser on any X-Cart page - the difference is easily noticable. Al Ponte
__________________
--------------------------------------------- Infosolv, LLC A Professional Services Company X-Cart v3.5.10 & 4.01 Find our MOD\'s at: Custom X-Cart MOD\'s, Add-On\'s & X-Cart Hosting! |
|||||||
#2
|
|||||||||
|
|||||||||
Have you tested this will all the JavaScript that is in X-Cart? Some JS does not function wel after removing whitespace....
|
|||||||||
#3
|
|||||||||
|
|||||||||
Ok... I see... it is actually leaving the Javascript alone. Much different than {strip} tags. Interesting....
|
|||||||||
#5
|
|||||||
|
|||||||
Thanks Adian009,
Works great in 3.5.8! Before I had 417 lines of code in one of my pages, now I have 404 I was looking for this function, even wanted to use external editor. |
|||||||
#6
|
|||||||||
|
|||||||||
Very good discovery !! Its speeded up my site
__________________
Darren Kierman Carlisle Glass (http://www.carlisleglass.co.uk/) ... running X-Cart Gold 4.4.5 [unix] |
|||||||||
#7
|
|||||||
|
|||||||
Did anyone find that it stripped out the spaces in the e-mail templates too?
|
|||||||
#8
|
|||||||
|
|||||||
Quote:
Anyone know if there is a way to prevent this by perhaps putting certain tags in the email templates that prevent them from having the spaces stripped out? One problem I found with using {strip} tags is that two Smarty tags with a space between them will be butted up against each other, and so to maintain the spacing I had to put "" between them. Does this problem happen with this Smarty modification?
__________________
X-Cart Pro 4.5.5 Platinum X-Payments 1.0.6 PHP 5.3.14 MySQL 5.1.68 Apache 2.2.23 |
|||||||
#9
|
|||||||
|
|||||||
Replies to All
Well, you use {literal}{/literal} with JavaScript and it won't be touched. I have been using this for 3 months without issue.
This will only strip whitespace from templates being sent to a client - not email as far as I know. --al
__________________
--------------------------------------------- Infosolv, LLC A Professional Services Company X-Cart v3.5.10 & 4.01 Find our MOD\'s at: Custom X-Cart MOD\'s, Add-On\'s & X-Cart Hosting! |
|||||||
#10
|
|||||||
|
|||||||
Some email templates are used for display in the browser.
I guess I will just stick with adding {strip} tags to various documents until I get this worked out.
__________________
X-Cart Pro 4.5.5 Platinum X-Payments 1.0.6 PHP 5.3.14 MySQL 5.1.68 Apache 2.2.23 |
|||||||
|
|||
X-Cart forums © 2001-2020
|