How to assign a local template variable with a string concatenated just like below:
{$yes_src=const1.'yes'.const2}
to be used below in the code in the manner {$yes_src}.
By the way I am looking for a job as PHP developer 🙂
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The way you are doing it is call the “short form” of
assign, you just need to use the correct quoting mechanism:Use
assign:Use
cat:You can also simply put the variables next to one another without assigning it to a variable:
… no variable needed.
A note If you find yourself using
assignmore than rarely, you might have a misconception about the ideas of separating logic from presentation. Usually, concatenation and other variable work would be accomplished in PHP before the template is ever involved. The template’s role is to just display the data, you should avoid creating or altering the data in the template.Documentation
assign– http://www.smarty.net/docs/en/language.function.assign.tplcat– http://www.smarty.net/docsv2/en/language.modifier.cat