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
  #21  
Old 06-18-2004, 06:07 AM
 
NuAlpha NuAlpha is offline
 

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

Default

For your plain emails, put all of your extra spaces and newlines in the literal tags. Not the whole template.
__________________
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
  #22  
Old 06-24-2004, 08:58 AM
 
Ryano Ryano is offline
 

Senior Member
  
Join Date: Jun 2004
Posts: 192
 

Default

Does this remove the spaces between the vertmenu boxes as well, or just items within the main area? So will "Your Cart" be touching "Authentication", or will they still have a small space in between them?
__________________
xcart v3.5.8 (Unix)
and
xcart v4.0.13
Reply With Quote
  #23  
Old 06-24-2004, 11:10 AM
  B00MER's Avatar 
B00MER B00MER is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Keller, TX (Cart-Lab.com)
Posts: 3,165
 

Default

Quote:
Originally Posted by Ryano
Does this remove the spaces between the vertmenu boxes as well, or just items within the main area?

No, This doesn't relate to spacing vertical or horizontal that the browser will interrupt, to see what it does, disable the added code, view the source of your store, keep it open, then readd the code, and refresh your store, and view the source again.

You'll see what it does
__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart.
Reply With Quote
  #24  
Old 06-24-2004, 04:09 PM
  adpboss's Avatar 
adpboss adpboss is offline
 

X-Man
  
Join Date: Feb 2003
Location: Ontario, Canada
Posts: 2,389
 

Default

Quote:
Originally Posted by NuAlpha
For your plain emails, put all of your extra spaces and newlines in the literal tags. Not the whole template.

What a PITA. I don't see me going through every single template for that. :P
Reply With Quote
  #25  
Old 06-24-2004, 04:18 PM
 
NuAlpha NuAlpha is offline
 

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

Default

Quote:
Originally Posted by adpboss
What a PITA. I don't see me going through every single template for that. :P

Well, then I suggest you do the sensible thing and switch to HTML email. :P

What does PITA stand for anyway??
__________________
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
  #26  
Old 06-24-2004, 04:27 PM
  adpboss's Avatar 
adpboss adpboss is offline
 

X-Man
  
Join Date: Feb 2003
Location: Ontario, Canada
Posts: 2,389
 

Default

Pain in the @$$.

Not all of my customers can receive html mail. Do you recommend that I ignore them?
Reply With Quote
  #27  
Old 06-24-2004, 04:45 PM
 
NuAlpha NuAlpha is offline
 

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

Default

Hmm...maybe there should be an option for individual customers to receive the email in HTML or plain text when they sign-up. Anybody got an idea how to do this?

Use a text editor that supports regular expressions to wrap all of the newlines or spaces with literal tags.

Use the following for the search:
Code:
'/([\n\r\f\t ]+)/'

Use this for the replace:
Code:
{literal}\1{/literal}

EditPad is really good for this. If you use PHP for the replacement, make sure you use \$1 instead of \1

Let me know if this works for you!

PS: Don't forget to back-up those files first!
__________________
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
  #28  
Old 06-28-2004, 06:14 PM
 
NuAlpha NuAlpha is offline
 

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

Default

Update on that regular expression. Try using /([ ]{2,}|[\n\r\f\t]+)/ instead as this seems to actually work. The previous regex I posted fubars the plain text templates by putting {literal} tags inside other Smarty tags.

This new one should allow you to easily upgrade your plain text templates and still use the Smarty mod posted here.
__________________
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
  #29  
Old 08-11-2004, 02:52 PM
 
xcell67 xcell67 is offline
 

Senior Member
  
Join Date: Dec 2003
Posts: 149
 

Default

NuAlpha,

I can't get your solution to work, so I tried various methods of your code, this is what I did with one of my mail templates:

Code:
{literal}\1{/literal} {$lng.lbl_dear} {$userinfo.title} {$userinfo.firstname} {$userinfo.lastname}, {literal}\1{/literal} {literal}\1{/literal} {$lng.eml_you_have_been_registered} at {$config.Company.company_name}! Setting up a {$config.Company.company_name} account entitles you to quick and easy online shopping. {literal}\1{/literal} With a {$config.Company.company_name} account, you can easily track and manage your orders, update your information, add items to your wishlist and much more! {literal}\1{/literal} Below are your account details: {literal}\$1{/literal} Account Information: --------------------- {$lng.lbl_username}: {$userinfo.login} {literal}'/([\n\r\f\t ]+)/'{/literal} {$lng.lbl_password}: {$userinfo.password} {literal}/([\n\r\f\t ]+)/{/literal} {$lng.lbl_first_name}: {$userinfo.firstname} {literal} {/literal} {$lng.lbl_last_name}: {$userinfo.lastname} {literal}/([ ]{2,}|[\n\r\f\t]+)/ {/literal} {if $userinfo.company}{$lng.lbl_company}: {$userinfo.company}

but this is what I ended up with:

\1
Dear Mr.adsfe21
\1
\1
You have been registered at Your Company Name!
Setting up a Your Company Name account entitles you to quick and easy online shopping.
\1
With a Your Company Name account, you can easily track and manage your orders, update your information, add items to your wishlist and much more! \1 Below are your account details: \$1 Account Information:
---------------------
Username: adsfe21@saol.net
'/([\n\r\f\t ]+)/'
Password: adsfe21
/([\n\r\f\t ]+)/
First Name: adsfe21
Last Name: adsfe21
/([ ]{2,}|[\n\r\f\t]+)/
E-Mail: adsfe21@saol.net
Reply With Quote
  #30  
Old 08-11-2004, 02:57 PM
 
Adian009 Adian009 is offline
 

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

Default

I originally suggested using this and I guess people are benefiting - that is awesome!

I just want to interject - I have never had any issues using this script, even with my plain text emails?!?

I just tested them again - still no problem...I wonder why? I will do more research to see if my implementation of this differs from everyone else's...I will let you all know, soon!

--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!
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 09:11 AM.

   

 
X-Cart forums © 2001-2020