编辑 php 个模板

Edit php template

我想编辑我的 php 模板,但我做不对。 我用的是Smarty模板引擎。

我的默认 php 行如下所示:

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

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

我试过了,但是不行:

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

我该如何解决这个问题?

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

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