• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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
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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.