1
goffy
use line-break in tpl files
  • 2020/2/13 21:44

  • goffy

  • Just can't stay away

  • Posts: 535

  • Since: 2010/12/27


Hi

I have a specific problem in xnewsletter:
I am sending various mails based on a tpl-file.
the tpl looks e.g. like this:
Quote:
Dear {SEX} {FIRSTNAME} {LASTNAME}

You have requested the registrations of email address {EMAIL}.
This email address is currently registered for following newsletters:
{RESULT}

You can change registrations by following link:
{CHANGELINK}

-----------------------
{X_SITENAME}
({X_SITEURL})
Webmaster {X_ADMINMAIL}


To fill in this tpl I use e.g.
....      
$xoopsMailer->setTemplate('subscriptions.tpl');
.....
$xoopsMailer->assign('FIRSTNAME'$firstname);

and this is working fine.

but now I create a list of all newsletter, where someone is subscribed and it should look like
Quote:
Newsletter 1
Newsletter 2
Newsletter 3


if I use
$xoopsMailer->assign('RESULT''Newsletter 1<br>Newsletter 2<br>Newsletter 3);

I get in the mails also Quote:
Newsletter 1<br>Newsletter 2<br>Newsletter 3

the same with \r\n, \r or \n

how can I get a line break?

2
zyspec
Re: use line-break in tpl files
  • 2020/2/13 22:41

  • zyspec

  • Module Developer

  • Posts: 1095

  • Since: 2004/9/21


@goffy,

This may depend on if you're sending the email as HTML or plain text. $xoopsMailer->setHTML(true|false);

Instead of using
$xoopsMailer->assign('RESULT''Newsletter 1<br>Newsletter 2<br>Newsletter 3);

I would suggest you try something like:
$xoopsMailer->assign('RESULT''Newsletter 1' chr(10) . 'Newsletter 2' chr(10) . 'Newsletter 3');


Let us know what you find out....

3
geekwright
Re: use line-break in tpl files

Quote:
goffy wrote: ... if I use
$xoopsMailer->assign('RESULT''Newsletter 1<br>Newsletter 2<br>Newsletter 3);
I get in the mails also Quote:
Newsletter 1
Newsletter 2
Newsletter 3
the same with \r\n, \r or \n how can I get a line break?
The string is defined in single quotes, so the \n and \r each are treated as 2 characters, not the control character you expect.https://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.single

4
goffy
Re: use line-break in tpl files
  • 2020/2/14 15:58

  • goffy

  • Just can't stay away

  • Posts: 535

  • Since: 2010/12/27


hi zyspec
hi geekwright

sometime you can't see the forrest because of the trees

thanks, both is working
Quote:
$xoopsMailer->assign('RESULT', 'Newsletter 1' . chr(10) . 'Newsletter 2' . chr(10) . 'Newsletter 3');

Quote:
$xoopsMailer->assign('RESULT', "Newsletter 1 \n Newsletter 2 \n Newsletter 3");

Login

Who's Online

153 user(s) are online (87 user(s) are browsing Support Forums)


Members: 0


Guests: 153


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits