0

So I am currently doing a custom WHMCS template that uses the smarty template system. One of the calls is as follows:

{$customfield.input|replace:'>':'placeholder="Placeholder' >'}

Now this works in that it sets the placeholder with the text Placeholder. What I am trying to achieve is to get the following variable inside where the Placeholder text is:

{$customfield.name}

So I need something like the following:

{$customfield.input|replace:'>':'placeholder="{$customfield.name}" >'}

but that doesn't work.

Is this possible?

2 Answers 2

1

Correct way to do it

{$customfield.input|replace:'>':"placeholder='`$customfield.name`' >"}
Sign up to request clarification or add additional context in comments.

Comments

0

Drop the braces around the second variable:

{$customfield.input|replace:'>':'placeholder="{$customfield.name|escape:html}" >'}

4 Comments

That just shows $customfield.name inside the placeholder instead of the actual variable.
That doesn't seem to work either :( Doesn't show any input field so I guess it breaks the templating system.
Okay let's try that last edit. Then I'm fresh outta ideas. :(
Got the answer: {$customfield.input|replace:'>':"placeholder='$customfield.name' >"}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.