Description of the annotation and truncation functions in Smarty, and description of the smarty truncation function. Description of the annotation and truncation functions in Smarty. description of the smarty truncation function the annotation copying code is as follows: {* This is a single line of Smarty annotation from jb51.net. the annotation and truncation functions in Smarty cannot be seen in the source code of the webpage, introduction to the smarty truncation function
Note
The code is as follows:
{* This is a single line of Smarty annotation from jb51.net, which is invisible in the source code of the webpage *}
{* This is a multiline
Smarty comments
Not sent to the browser
*}
Template comments are surrounded by asterisks and then surrounded by delimiters. type: {* This is a comment *}. The Smarty annotation is not displayed in the output of the final template. The former is useful for inserting internal comments in the template, because no one can see it .; -)
Http://www.itlearner.com/code/smarty_cn/language.basic.syntax.html
Truncate
The code is as follows:
$ Smarty-> assign ('hxtitle', 'Two Sisters Reunite after Eighteen Years at Checkout Counter .');
Template:
The code is as follows:
{$ Hxtitle}
{$ Hxtitle | truncate}
{$ Hxtitle | truncate: 30}
{$ Hxtitle | truncate: 30 :""}
{$ Hxtitle | truncate: 30 :"---"}
{$ Hxtitle | truncate: 30: "": true}
{$ Hxtitle | truncate: 30: "...": true}
{$ Hxtitle | truncate: 30: '...': true}
Output:
The code is as follows:
Two Sisters Reunite after Eighteen Years at Checkout Counter.
Two Sisters Reunite after Eighteen Years at Checkout Counter.
Two Sisters Reunite after...
Two Sisters Reunite after
Two Sisters Reunite after ---
Two Sisters Reunite after Eigh
Two Sisters Reunite after E...
Two Sisters Re... ckout Counter.
You don't have to truncate it in PHP: http://www.itlearner.com/code/smarty_cn/language.modifier.truncate.html
Pipeline annotation code is as follows: {* This is a single line of Smarty annotation from jb51.net, which is invisible in the source code of the webpage...