In my php file to send emails I would like to use smarty config variables however currently I have to cut them
This is part of the PHP file:
PHP
$messagecontent .= "
<p>bla bla bla bla <b> $username </b> xxxx <b> $myitemname </b>
<p>When you receive xxx go to xxxx</p>
feel free to <a href=".WEBSITEHOST."contact-us.php>contact us </a> at any time.<br />";
Currently I am creating different smarty config vars like so:
$messagecontent .= $smarty->getConfigVariable('welcomemail1'). $username $smarty->getConfigVariable('welcomemail2'). $myitemname." </b>
<p>When you receive xxx go to xxxx</p>
feel free to <a href=".WEBSITEHOST."contact-us.php>contact us </a> at any time.<br />";
Can I do all at once somehow (include the php vars in the smarty config files)
So: $messagecontent =$smarty->getConfigVariable('welcomemail');
And how will {#welcomemail#} include those? eg welcomemail="??"
you can use sprintf
ie in your config file you will have
welcomemail = "bla bla bla %1$s blablabla %2$s ...."
and then in php
$messagecontent = sprintf ($smarty->getConfigVariable('welcomemail'),$username,$itemname);
However, I think that the easiest and most flexible way to create mails is to write a template for the body of the mail, process it with smarty and get the output in a variable instead of displaying it on the screen
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.