I am using smarty for template. I am fetching one issue with rendering. i have one variable value of that variable is
this is text" data
but when i print this value in tpl file it prints only this is text
except the
this is text" data
Why this is happening? please help Thanks in advance
In smarty you can escape the data using {$variable|escape:'format'}
In this case a format of html should do the trick
{$variable|escape:html}
ref: http://smarty.net/docsv2/en/language.modifier.escape.tpl
You shouldn't be using quotes in HTML text-nodes anyway (it's invalid). Use "
(escaped) instead.
So for your example:
this is text" data
If your text is coming from your DB, use htmlspecialchars()
to properly escape it:
$val = htmlspecialchars($val);