Comments and truncation features in Smarty Introduction to _php templates

Source: Internet
Author: User

Comments

Copy Code code as follows:

{* This is a single line smarty comments from Jb51.net, the Web page source code cannot see *}


{* This is a multiline
Smarty Notes
Not sent to browser
*}

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, this is different. The former is useful for inserting internal annotations into templates, as no one can see. ;-)

Http://www.itlearner.com/code/smarty_cn/language.basic.syntax.html

Truncate truncate

Copy Code code as follows:

$smarty->assign (' Hxtitle ', ' two sisters reunite after eighteen Years at Checkout Counter. ');

The template is:

Copy 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 Code code as follows:

Two sisters reunite after eighteen Years at Checkout Counter.
Two sisters reunite after eighteen Years at Checkout Counter.
Two sisters reunite ...
Two sisters reunite after
Two sisters reunite after---
Two sisters reunite after Eigh
Two sisters reunite after E ...
Two sisters Re. Ckout Counter.

Can not be intercepted in PHP: http://www.itlearner.com/code/smarty_cn/language.modifier.truncate.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.