Thinkphp Getting started three-frame templates, variables (47)

Source: Internet
Author: User

Original: Thinkphp Getting started three-frame templates, variables (47)

"Call template on Controller"

Display () a template that invokes the name of the current operation

Display (' name ') invokes the template file of the specified name

Controller call template Four ways:

"Passing variables to the template in the controller"

Passing variable information to a template inside Smarty

$smarty-Assign (variable name, value);

Within the TP frame the same applies to assign () passing variable information to the template

Thinkphp the left and right tags of the template engine:

thinkphp/lib/behavior/parsetemplatebehavior.class.php

Modify the TP template engine tag

Modify the template engine to Smarty

1 pass variable information to the template in two ways:

$this-Assign (name, value);

$this, name = value;

You can modify the left and right marks of the TP template engine

We can modify the template engine to Smarty

2 Output common variable information in template

3 output array element information inside the template

1 {$hobby [table below]}

2 {$hobby. The following table}

Output object's property information inside the template

{$ucenter Property name}

{$ucenter: Property name}

"Traversing Array Information"

Two methods:

foreach and volist can be nested traversal, the deepest level is 3 layers.

foreach (parameter 1, parameter 2, parameter 3)

Volist (parameter 1 parameter 2 parameter 3)

Name: template array variable names

ID: traversed element information

Key: element below table information (key i)

Offset: Output array offset

Length: Shows the number of output elements

MoD: For the specified number, modulo

Empty: array Specifies information for NULL transport

"Normal for loop output"

Lt:less than less than <

Gt:great than greater than

Eq:equal equals

Elt:less equal less than or equal to

Egt:great equal greater than or equal to

Heq:heng equal constant equals

Nheq:not Heng equal not constant equals

"Conditional judgment Structure"

If judgment

Two-way branch:

Multi-Channel Branch:

"Scope judgment"

In between

inch Label Use

between Label Use

Range Label Use ( in and between integrated tabs )

"Constant equals"

Thinkphp Getting started three-frame templates, variables (47)

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.