X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Smarty.php Mod to Remove all UN-NECESSARY White Space (https://forum.x-cart.com/showthread.php?t=7920)

NuAlpha 08-11-2004 03:05 PM

xcell67, it looks as if spaces are literally being replaced by the regular expression itself! 8O

If you are using PHP, please post the exact preg_replace() code that you are using including the regular expression and replacement in that code.

If you are using EditPad, select the regular expressions option in the search box and use the regex ([ ]{2,}|[\n\r\f\t]+) with the replace {literal}\1{/literal}

xcell67 08-11-2004 10:39 PM

I tried using dreamweaver to do it manually, I put {literal}, pressed enter twice to insert a blank line then ended it with {/literal}

I also tried your method with Editpad but still no luck =(

One thing that did manage to work for me was putting <PRE> and ending with </PRE>. That allows the blank lines between text but I don't think its too customer friendly to have those tags in the mails.

Can all you lucky people who have managed to get this to work post a sample tpl from your mail folder.

Thanks.

TonyD 08-12-2004 10:57 AM

works well for me in 4.0.1 :lol:

Adian009 08-12-2004 04:39 PM

You *must* place this call after $mail_smarty is instantiated - then it WILL NOT PARSE THE MAILS. :)

Here is my placement and all will be well!

#
# Smarty object for processing mail templates
#
$mail_smarty = $smarty;

$smarty->load_filter("output","trimwhitespace");

#
# WARNING :
# Please ensure that you have no whitespaces / empty lines below this message.
# Adding a whitespace or an empty line below this line will cause a PHP error.
#
?>

xcell67 08-12-2004 06:53 PM

WHOOOOOO! I finally got my mail tpls to work with your solution kind sir.

Thank you and thank you to NuAlpha for helping me with his solution.

This is a sweet mod.

Adian009 08-12-2004 07:59 PM

Quote:

Originally Posted by xcell67
WHOOOOOO! I finally got my mail tpls to work with your solution kind sir.

Thank you and thank you to NuAlpha for helping me with his solution.

This is a sweet mod.


That's great - glad to know I could help out!

I wish I was monitoring this thread actively - I am now...hopefully it wasn't too late!

--al ponte

bluecat 08-22-2004 01:01 PM

Works in 4.0.2, thank you. :)

NuAlpha 01-09-2005 09:21 AM

Under PHP 4.3.10, I have found that unless I remove the line $smarty->load_filter('output','trimwhitespace'); from smarty.php then the entire Xcart load process will abort suddenly for some unknown reason.

Has anyone else experienced this?

CopperB 04-16-2005 09:41 PM

This is a great MOD but any HTML invoices received by customers were blank.

Quote:

Under PHP 4.3.10, I have found that unless I remove the line $smarty->load_filter('output','trimwhitespace'); from smarty.php then the entire Xcart load process will abort suddenly for some unknown reason.


I tried adding $smarty->load_filter('output','trimwhitespace'); and it caused problems with images on the website.

As a result I removed the mod for now until I can find a solution.

Anyone have any ideas?

heartsfire 04-17-2005 12:27 PM

Sweet
 
Thanks


All times are GMT -8. The time now is 02:49 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.