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 06-18-2004 06:07 AM

For your plain emails, put all of your extra spaces and newlines in the literal tags. Not the whole template.

Ryano 06-24-2004 08:58 AM

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?

B00MER 06-24-2004 11:10 AM

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 ;)

adpboss 06-24-2004 04:09 PM

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

NuAlpha 06-24-2004 04:18 PM

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 :wink:

What does PITA stand for anyway?? :roll:

adpboss 06-24-2004 04:27 PM

Pain in the @$$. :)

Not all of my customers can receive html mail. Do you recommend that I ignore them?

NuAlpha 06-24-2004 04:45 PM

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!

NuAlpha 06-28-2004 06:14 PM

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. :wink:

xcell67 08-11-2004 02:52 PM

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

Adian009 08-11-2004 02:57 PM

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


All times are GMT -8. The time now is 08:47 AM.

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