Introduction to annotations and truncation in Smarty, Smarty truncation feature _php tutorial

Source: Internet
Author: User

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 ...

  • 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.