The variables passed from the PHP page to the Smarty template (replaced here by creating two variables on Smarty)
Copy the code The code is as follows:
{assign var="name" value='Richard.Lee'}
{assign var="age" value='27'}
1. Want to output at a certain position in the Smarty template (Richard.Lee---27)
Splicing method: {$name|cat:"---"|cat:$age}
Explanation: The variables $name, "---", and $age are spliced into a string
2. If you want to output (name: Richard.Lee, age: 27) at a certain position in the Smarty template, the splicing method is:
Copy code The code is as follows:
{"Name: "|cat:$name|cat:", Age: " |cat:$age}
{"Name:"|cat:$name|cat:","|cat:"Age:"|cat:$age}
Explanation: The effect obtained by the two splicing methods is the same
Remarks: The method found on the Internet does not fully understand the role of |cat:, but after two simple examples, a simple conclusion can be drawn: it can be |cat: regarded as the symbol of the link string, equivalent to the dot (.) in the PHP file.
http://www.bkjia.com/PHPjc/825259.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/825259.htmlTechArticleThe variables passed from the PHP page to the Smarty template (replaced here by creating two variables on Smarty) Copy code The code is as follows: {assign var="name" value='Richard.Lee'} {assign var="age" v...