Forums

Email custom template but include line feeds and carriage returns

pgrnycomdir 09 Feb, 2019
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 09 Feb, 2019
{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.
pgrnycomdir 10 Feb, 2019
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 10 Feb, 2019
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
pgrnycomdir 10 Feb, 2019
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 10 Feb, 2019
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}
pgrnycomdir 10 Feb, 2019
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 10 Feb, 2019
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}
pgrnycomdir 10 Feb, 2019
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
pgrnycomdir 10 Feb, 2019
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
This topic is locked and no more replies can be posted.