I have tried the email templates. It makes sending emails a lot easier. Thanks a lot for your hard work.
One question: How can I format the date differently? It always appears in yyyy-mm-dd format. I want to format it as dd.mm.yyyy.
Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
Email templates
-
- nuBuilder Team
- Posts: 4297
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 444 times
- Contact:
Re: Email templates
Hi,
Replace the Hash Cookie with the formatted date value before it's replaced with nuReplaceHashVariables():
Replace the Hash Cookie with the formatted date value before it's replaced with nuReplaceHashVariables():
Code: Select all
function formatDate($date, $format) {
if ($date == "") {
return "";
}
$date = DateTime::createFromFormat('Y-m-d', $date);
return $date->format($format);
}
$body = nl2br($template['body'];
$body = str_replace( "#"."your_field"."#", formatDate("#your_field#", "d.m.Y"), $body );