问题
I am passing my HTML string to the $content variable and trying to display it, in the result I see raw HTML tags instead of the string markup.
Controller:
$content = "<strong>Test markup</strong>";
index.tpl:
{$content} - displays just raw variable content without markup: <strong>Test markup</strong> INSTEAD of the Test markup.
When I type manually the above variable content in the index.tpl then it works just fine so it seems to be some variable-related issue.
What have I tried:
{content|nofilter} - to be sure its not caused by any of the Smarty's variable filters.
Could someone help me to localize the problem?
回答1:
Please try:
{$content|unescape:'html'}
More details on: http://www.smarty.net/docs/en/language.modifier.unescape.tpl
来源:https://stackoverflow.com/questions/21242713/smarty-displays-raw-html