【问题标题】:mustache: insert a string literal into a template filtermustache:将字符串文字插入模板过滤器
【发布时间】:2014-10-10 19:09:24
【问题描述】:

我想做以下事情(是php mustache版渲染的模板):

<h1>{{hello|my_filter}}</h1>

其中hello 是文字字符串,而不是变量名。

我该怎么做?

【问题讨论】:

  • Mustache 应该是无逻辑的。你应该在你的控制器中使用你的过滤器,而不是在你的模板中进行这种处理。
  • 我想在模板中使用gettext,所以my_filtergettext($text)函数

标签: php mustache


【解决方案1】:

最后我做了以下事情:

<h1>{{#my_filter}}hello{{/my_filter}}</h1>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-05-23
    • 1970-01-01
    • 2014-02-28
    • 2020-01-31
    • 2023-03-21
    • 1970-01-01
    • 2019-08-12
    • 1970-01-01
    相关资源
    最近更新 更多