Introduction to annotations and truncation in Smarty, introduction of smarty truncation function
Comments
Copy the Code code as follows:
{* This is a single-line smarty comment from Jb51.net, the page source code is not visible *}
{* This is a multi-line
Smarty Notes
Not sent to the browser
*}
The template comments are surrounded by asterisks and then surrounded by delimiters, such as: {* This is a comment *}. Smarty annotations are not displayed in the output of the final template, and this is different. The former is useful for inserting internal annotations in templates, because no one can see them. ;-)
Http://www.itlearner.com/code/smarty_cn/language.basic.syntax.html
Truncate truncate
Copy the Code code as follows:
$smarty->assign (' Hxtitle ', ' both sisters reunite after eighteen years at Checkout Counter. ');
The template is:
Copy the Code code 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:true}
The output is:
Copy the Code code as follows:
Sisters reunite after eighteen years at Checkout Counter.
Sisters reunite after eighteen years at Checkout Counter.
Sisters reunite after ...
Sisters reunite after
Sisters reunite after---
Sisters reunite after Eigh
Sisters reunite after E ...
Sisters Re. Ckout Counter.
Can not be intercepted in PHP: http://www.itlearner.com/code/smarty_cn/language.modifier.truncate.html
http://www.bkjia.com/PHPjc/981350.html www.bkjia.com true http://www.bkjia.com/PHPjc/981350.html techarticle description of annotations and truncation in Smarty, the Smarty truncation feature describes the code for the copy code as follows: {* This is a single-line smarty comment from Jb51.net, the page source code is invisible ...