Henk Z Henk Z - 1 year ago 148
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?

Answer Source

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}
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download