简体   繁体   中英

Smarty displays raw HTML

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?

Please try:

{$content|unescape:'html'}

More details on: http://www.smarty.net/docs/en/language.modifier.unescape.tpl

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM