Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

show a smarty variable with html content

Tags:

html

smarty

I have a smarty variable with html content in it like: $html="<strong>Content</strong><br/>etc etc" . I try to show it html-formatted. When showing it like {$html} only plain text appears without formatting. I try like: {$html|unescape} but then the tags are shown but not applied. Do you have any suggestions?

like image 761
user985409 Avatar asked May 08 '13 20:05

user985409


2 Answers

Interestingly, none of the answers here work with Smarty 3.1.21 on CS-Cart 4.3.4. So, just to add another thought in that circumstance, use the nofilter on the $html string like so:

{$html nofilter}

like image 124
dhaupin Avatar answered Sep 18 '22 19:09

dhaupin


You should try this:

{$html|unescape:'html'}

Also check manual:

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

like image 43
WaPaRtY Avatar answered Sep 19 '22 19:09

WaPaRtY