Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
537 views
in Technique[技术] by (71.8m points)

php - How to render Html with smarty

I'm trying to render my raw HTML with smarty.

{if !empty($brand.description)}
  {$brand.description}
{/if}

The original text contains spaces and text returns, but when displayed, HTML is shown as plain text.

Also, I tried to add {$brand.description|strip_tags:'UTF-8'} as a filter for my string. But it's only deleting my HTML.

How can my smarty template render this string as pure HTML?

question from:https://stackoverflow.com/questions/65892774/how-to-render-html-with-smarty

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Answer is...

{$brand.description nofilter}

Also, you can disable this indicator by change default smarty behavior:

$smarty->setEscapeHtml(false);

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...