编辑php模板

时间:2016-06-20 14:30:21

标签: php smarty

我想编辑我的php模板,但我无法正确使用它。 我使用Smarty模板引擎。

我的默认php行看起来像这样:

{$customfield.input|replace:'>' : 'class="form-control" >'}

我有另外一个php标签,我想要合并:{$customfield.name}

我试过了,但这不起作用:

{$customfield.input|replace:'>' : 'placeholder="'.{$customfield.name}.'" class="form-control" >'}

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

你的语法错了。你不能用“。”在smarty中连接字符串。试试这个:

{$replaceby = 'placeholder="'|cat:$customfield.name|cat:'" class="form-control" >'}
{$customfield.input|replace:'>' : $replaceby}
相关问题