Template Engine Smarty II

Source: Internet
Author: User
Tags smarty template

Conditional Judgment statements (these statements are written in the Smarty template)

{if $name eq ' Tom '}

Welcome Sir

{elseif $name eq ' Wilma '}

Welcome Ma ' am

{Else}

Welcome,whatever Yu is

{/if}

Note: Start with an If, end with/if, format fixed;

EQ modifier, equivalent to ' = = '

NEQ, the equivalent of '! = ';

GT, equivalent to ' > ';

LT, equivalent to ' < ';

Circular Statement Section

1. More functions, more parameters. Smarty one of the functions used to do cyclic operations

2. Basic attribute Name,loop

For example, an array is a two-dimensional array $arr = array (' Age ' = ' ~ ', ' job ' = ' computer '), Array (' age ' = ' + ', ' job ' = ' music ');

{section Name=mark loop= $arr}

{$arr [Mark].age}

{$arr [Mark].job}

<br/>

{/section}

As you can see, the format is fixed; name equals an assignment subscript, loop specifies the array to loop the output

3.section Other properties

3.1start the starting position of the loop;

3.2step determines the step size of the loop, such as step=2, and only iterates through the elements labeled 0,2,4, etc.

3.3max set the number of executions for the loop

3.4show determines whether the loop is displayed

  

Template Engine Smarty II

Related Article

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.