This article describes how to concatenate strings in the smarty template. For more information, see the variables uploaded to the Smarty template on the PHP page)
The code is as follows:
{Assign var = "name" value = 'Richard. Lil '}
{Assign var = "age" value = '27 '}
1. output in a certain position of the Smarty template (Richard. Lee --- 27)
Splicing method: {$ name | cat: "---" | cat: $ age}
Explanation: concatenates variables $ name, "---", and $ age into a string.
2. if you want to output (name: Richard. Lee, Age: 27) somewhere in the Smarty template, the splicing method is as follows:
The code is as follows:
{"Name:" | cat: $ name | cat: ", age:" | cat: $ age}
{"Name:" | cat: $ name | cat: "," | cat: "age:" | cat: $ age}
Explanation: The two splicing methods have the same effect.
Note: The method found on the Internet is not very understandable | cat:, but after two simple examples, it is concluded that | cat: can be considered as a symbolic link string, it is equivalent to the point (.) in the PHP file (.).