【问题标题】:How to render Html with smarty如何用 smarty 渲染 Html
【发布时间】:2021-01-25 21:34:39
【问题描述】:

我正在尝试使用 smarty 呈现我的原始 HTML。

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

原始文本包含空格和文本返回,但显示时,HTML 显示为纯文本。

另外,我尝试添加{$brand.description|strip_tags:'UTF-8'} 作为我的字符串的过滤器。但它只会删除我的 HTML。

我的 smarty 模板如何将这个字符串呈现为纯 HTML?

【问题讨论】:

    标签: php html prestashop smarty


    【解决方案1】:

    答案是……

    {$brand.description nofilter}
    

    此外,您可以通过更改默认 smarty 行为来禁用此指示器:

    $smarty->setEscapeHtml(false);
    

    【讨论】:

      猜你喜欢
      • 2019-10-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-09-13
      • 2018-01-16
      • 1970-01-01
      • 2020-10-11
      相关资源
      最近更新 更多