Buy Now
Sign in

Email custom template but include line feeds and carriage returns

pgrnycomdir , February 09 at 17:49
P
pgrnycomdir 46
February 09 at 17:49 #383771
I have a custom template for emailing.
My only problem is that the custom template does not include the control characters of "line feeds and carriage returns" while the auto template does. There are several paragraph type pieces of information and the user fills in with line feeds and carriage returns, yet my custom template ignores this and everything is run on.
How can I make the custom template forward the data including line feeds and carriage returns???
Thank you in advance for any help.
Donna
healyhatman 5.7
February 09 at 21:28 #383773
{var.br:email_text}
Will convert all the carriage returns in your email_text variable (for example if you've built it using a custom code block) to < br > tags.
Web developer at SkySpider.com.au
I don't work for ChronoEngine but I do accept donations paypal.me/healyhatman

You can now copy+paste code from forums
P
pgrnycomdir 46
February 10 at 00:06 #383779
Healyhatman,
This is for the same custom email template you helped me with to implode the Regions a couple of days ago.
What I'm not sure of, is why it took out the <br> from the fields in the first place. It basically is the same data as if I had chosen the auto template except that I reordered the data and took out some of the field names. It's a table coming into gmail (which is exactly what I want), but because I went to custom template, it takes out the <br> that the user puts in with line returns in some of the text area fields.
Where do I put the {var.br:email_text} statement? Do I add another custom block for that particular email?
Or can I add it to the end of the php code block?
healyhatman 5.7
February 10 at 00:10 #383780
No, when the user enters data it gets put in as \n or \r line breaks, not <br>
Use {var.br:varname} converts line breaks to <br> tags
Web developer at SkySpider.com.au
I don't work for ChronoEngine but I do accept donations paypal.me/healyhatman

You can now copy+paste code from forums
P
pgrnycomdir 46
February 10 at 00:16 #383781
OK, now I understand what happens.
But where to I paste the {var.br:varname} ????
And is it {var.br:varname} or {var.br:email_text} ???
Thank you so much for your patience with me. I kind of understand but am no coding wizard for sure.
Donna
healyhatman 5.7
February 10 at 00:25 #383782
Well you put it wherever you want it to show up. And it's whatever you've called the thing that has the text you want to convert and print. like if in your email you have
{var:read data.model.field}
That has the fields with the line breaks, you would instead do
{var.br:read data.model.field}
Web developer at SkySpider.com.au
I don't work for ChronoEngine but I do accept donations paypal.me/healyhatman

You can now copy+paste code from forums
P
pgrnycomdir 46
February 10 at 00:34 #383783
But these are all data fields. For example , here is a section of the custom email template:
<table width="100%" cellpadding="3" cellspacing="3" border="0" class="ui table">
<tr>
<td width="30%" valign="top" align="right"><strong>Mission applies to the following Region(s):</strong></td>
<td width="70%" valign="bottom" align="left">{var:php13}</td></tr>
<tr><td width="30%" valign="top" align="right"><strong>About the Mission:</strong></td><td width="70%" valign="top" align="left">{data:about_mission}</td></tr>
<tr><td width="30%" valign="top" align="right"><strong>Primary Staging Time:</strong></td><td width="70%" valign="top" align="left">{data:primary_time}</td></tr>
The field {data:about_mission} needs to have the \n replaced with <br>
So would I write that particular line as:
{var.br.read data:about_mission}
Or am I totally in the wrong place?
healyhatman 5.7
February 10 at 00:52 #383784
1
data.br:about_mission
Web developer at SkySpider.com.au
I don't work for ChronoEngine but I do accept donations paypal.me/healyhatman

You can now copy+paste code from forums
healyhatman 5.7
February 10 at 00:55 #383785
Or put all that email html code and PHP code in a single Custom Code block set to "return as var" and then in your email body just put {var.br:customcodeblockname}
Web developer at SkySpider.com.au
I don't work for ChronoEngine but I do accept donations paypal.me/healyhatman

You can now copy+paste code from forums
P
pgrnycomdir 46
February 10 at 00:59 #383786
I think I'll try the {data.br:about_mission} first. Everything is working perfectly except those few text areas. What they want is for authors of certain text to just copy and paste the full table and not to goof around with anything.
If this works, I would be good to go and another request from our moderators taken care of. This is a nonprofit and 100% volunteer organization, so we have all types of backgrounds trying to help.
And you sir, have been super helpful. I'll give this a try and let you know. Again my sincere thanks.
Donna
P
pgrnycomdir 46
February 10 at 02:19 #383787
Healy - problem solvers
You are certainly what your name implies. This again worked flawlessly.
Many thank and my deep appreciation for all your help!
Donna