2009-05-14 11:48
浏览 46


I'm currently using smarty with zend framework, and I have set up smarty to use gettext in the following manner:

{gettext text="resource-identifier"}

This works properly, but I got a problem when trying to use this with the smarty default variable handler. I want to do this:

{$somevar|default:gettext text="resource-identifier"}

But this only prints 'gettext'. Any suggestions to how I can do this. Is it even possible?

图片转代码服务由CSDN问答提供 功能建议


  {gettext text =“resource-identifier”} 

这项工作正常,但我遇到了问题 当试图使用smarty默认变量处理程序时。 我想这样做:

  {$ somevar | default:gettext text =“resource-identifier”} 
 <  p>但这只打印'gettext'。 有关如何做到这一点的任何建议。 它甚至可能吗? 
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • douwen6274 2009-05-14 13:42

    For smarty, chaining a result of a function isn't possible like that. You'll need to see if gettext can assign its result to a variable (an assign=varname param), or write your own (and at that point just write a new modifier that is like default_gettext:'resource-id')

    in the assumed assign, it'd look like:

    {gettext text="resource-id" assign="myvar"}

    In the new modifier it'd look like:

    打赏 评论

相关推荐 更多相似问题