如何分配只翻译一次并在模板中重复的smarty变量?



我尝试使用以下命令分配var并对其进行翻译,但失败了。

{assign var="figcaption" value="{l s='Free Migration or Installation' mod='twittercard'}"}

当我尝试使用smarty var {$figcaption}现在,我得到一个空字符串。

{capture}用于将模板在标签之间的输出收集到一个变量中,而不是显示它。{capture name='foo'}{/capture}之间的任何内容都被收集到name属性中指定的变量中。

{capture name="figcaption"}{l s="Free Migration or Installation" mod="twittercard"}{/capture}
    {$smarty.capture.figcaption}

使用http://www.smarty.net/docs/en/language.function.capture.tpl

最新更新