Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Smarty.php Mod to Remove all UN-NECESSARY White Space

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #31  
Old 08-11-2004, 03:05 PM
 
NuAlpha NuAlpha is offline
 

X-Adept
  
Join Date: Aug 2003
Location: US
Posts: 598
 

Default

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

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}
__________________
X-Cart Pro 4.5.5 Platinum
X-Payments 1.0.6
PHP 5.3.14
MySQL 5.1.68
Apache 2.2.23
Reply With Quote
  #32  
Old 08-11-2004, 10:39 PM
 
xcell67 xcell67 is offline
 

Senior Member
  
Join Date: Dec 2003
Posts: 149
 

Default

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.
Reply With Quote
  #33  
Old 08-12-2004, 10:57 AM
 
TonyD TonyD is offline
 

eXpert
  
Join Date: Mar 2004
Location: Okc
Posts: 288
 

Default

works well for me in 4.0.1
__________________
X-Cart v 4.7.8(live)
Reply With Quote
  #34  
Old 08-12-2004, 04:39 PM
 
Adian009 Adian009 is offline
 

Advanced Member
  
Join Date: Mar 2004
Location: Tiverton, RI, USA
Posts: 37
 

Default

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.
#
?>
__________________
---------------------------------------------
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!
Reply With Quote
  #35  
Old 08-12-2004, 06:53 PM
 
xcell67 xcell67 is offline
 

Senior Member
  
Join Date: Dec 2003
Posts: 149
 

Default

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.
Reply With Quote
  #36  
Old 08-12-2004, 07:59 PM
 
Adian009 Adian009 is offline
 

Advanced Member
  
Join Date: Mar 2004
Location: Tiverton, RI, USA
Posts: 37
 

Default

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
__________________
---------------------------------------------
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!
Reply With Quote
  #37  
Old 08-22-2004, 01:01 PM
 
bluecat bluecat is offline
 

X-Adept
  
Join Date: Nov 2002
Posts: 674
 

Default

Works in 4.0.2, thank you.
__________________
--------------------
X-Cart Gold 4.1.11
Linux/Apache
--------------------
Reply With Quote
  #38  
Old 01-09-2005, 09:21 AM
 
NuAlpha NuAlpha is offline
 

X-Adept
  
Join Date: Aug 2003
Location: US
Posts: 598
 

Default

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?
__________________
X-Cart Pro 4.5.5 Platinum
X-Payments 1.0.6
PHP 5.3.14
MySQL 5.1.68
Apache 2.2.23
Reply With Quote
  #39  
Old 04-16-2005, 09:41 PM
 
CopperB CopperB is offline
 

Advanced Member
  
Join Date: Jan 2005
Posts: 58
 

Default

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?
__________________
CopperB

XCart Gold -> v4.0.11
PHP -> v4.3.10
MySQL -> v4.0.22
Apache -> v1.3.33
Smarty -> v2.6.3
Reply With Quote
  #40  
Old 04-17-2005, 12:27 PM
 
heartsfire heartsfire is offline
 

Member
  
Join Date: Oct 2004
Location: Las Vegas, NV
Posts: 13
 

Default Sweet

Thanks
__________________
Ron Eason
http://www.heartsfireleathers.com
webmaster@heartsfireleathers.com
XCART 4.0.12
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 11:29 PM.

   

 
X-Cart forums © 2001-2020