Henk Z Henk Z - 2 months ago 9x
Smarty Question

Edit php template

I want to edit my php template, but I can not get it right.
I use the the Smarty template engine.

My default php line looks like this:

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

I have another php tag like, that I want to combine:

I tried this, but that does not work:

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

How can I fix this?


Your syntax is wrong. You can't use "." to concatenate strings in smarty. Try this instead:

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