Welcome Guest, Not a member yet? Register   Sign In
Parser, HTML visible and Email
#1

Hello,

I have a series of templates set up in my view directory.

When sending an email, i load the template by:
PHP Code:
$message $parser->setData($data)->parse($template_name); 


I then send that to an email wrapper which does the same task, only with

PHP Code:
$data[
...
'content' => $message


When sending the email (with mail_type = 'html') I receive all the text (HTML tags and all).
When printing the email (to see what would be sent), $message displays tags.

I am obviously using this wrong or missing something, i'm having trouble where i'm messing it up.

Thanks, Ryan
Reply
#2

(This post was last modified: 06-16-2020, 01:26 AM by ryanUGLE.)

If anyone comes across this with the same issue, i had to do the following:



PHP Code:
//SEE EDIT, this is left for reference. This line does not include 'raw' anymore
//See 'raw', where no escaping occurs.
$this->setData($data'raw')->render('templates/email/base');
//END SEE EDIT 

Edit:
I believe this would escape all the data, which for your usage it may vary. I have amended my 'email/base' template 'content' tag to {!content!}.
This escapes the 'content' data assignment but not the others.
Reply
#3

Thanks for this info, very helpful! keep it up!
Reply




Theme © iAndrew 2016 - Forum software by © MyBB