Reputation:
If I have a handlebar merge variable like {{message}}
in my template, how can I have it render HTML output if given the following in PHP:
array(
'name' => 'message',
'content' => '<p>First paragraph.</p><p>Second paragraph.</p>'
)
Right now it outputs the content without parsing the paragraph tags.
Upvotes: 5
Views: 4409
Reputation: 763
Actually when sending using mandrill the message variable has a field merge_language and when you change to this
'merge_language' => 'handlebars'
It works. For your case i think the value is default 'mailchimp' hence the need to use mc:edit
Upvotes: 8
Reputation: 321
If you're using Handlebars I think the proper way to do it is with triple braces, e.g:
{{{html_content}}}
I'm not sure it is ok to mix mc:edit with Handlebars in Mandrill:
Combining Handlebars with either mc:edit regions or merge tags in a single message isn't supported. You should pick Handlebars or mc:edit regions plus merge tags.
https://mandrill.zendesk.com/hc/en-us/articles/205582537-Using-Handlebars-for-dynamic-content
Upvotes: 14
Reputation:
To answer my own question, I just added mc:edit="message"
to the div containing the message, like this:
<div mc:edit="message"></div>
I then added this to my structure:
$template_content = array(
array(
'name' => 'message',
'content' => '<p>First paragraph.</p><p>Second paragraph.</p>'
),
);
Upvotes: 3