Home >Backend Development >PHP Tutorial >Getting Started with Thinkphp Three—Framework Templates, Variables (47), thinkphp47_PHP Tutorial

Getting Started with Thinkphp Three—Framework Templates, Variables (47), thinkphp47_PHP Tutorial

WBOY
WBOYOriginal
2016-07-13 09:51:07767browse

Thinkphp Getting Started Three - Framework Templates, Variables (47), thinkphp47

[Calling Templates in the Controller]

display() calls the template of the current operation name

display(‘name’) calls the template file with the specified name

Four ways for controllers to call templates:

Getting Started with Thinkphp Three—Framework Templates, Variables (47), thinkphp47_PHP Tutorial[Pass variables to the template in the controller]

Pass variable information to the template in smarty

$smarty -> assign(variable name, value);

In the tp framework, assign() is also used to pass variable information to the template

Left and right tags of ThinkPHP’s template engine:

ThinkPHP/Lib/ Behavior/ ParseTemplateBehavior.class.php

Modify TP template engine tag

Getting Started with Thinkphp Three—Framework Templates, Variables (47), thinkphp47_PHP Tutorial 1 There are two ways to pass variable information to the template:

$this -> assign(name, value);

$this -> name = value;

Getting Started with Thinkphp Three—Framework Templates, Variables (47), thinkphp47_PHP Tutorial 2 Output common variable information in the template

Getting Started with Thinkphp Three—Framework Templates, Variables (47), thinkphp47_PHP Tutorial 3 Output array element information in the template

1 {$hobby[list below]}

2 {$hobby.Table below}

Getting Started with Thinkphp Three—Framework Templates, Variables (47), thinkphp47_PHP TutorialOutput the attribute information of the object in the template

{$ucenter->property name}

{$ucenter:property name}

Getting Started with Thinkphp Three—Framework Templates, Variables (47), thinkphp47_PHP Tutorial[Traverse array information]

Two methods:

Foreach and volist can be nested traversal, the deepest level is 3 levels.

foreach(parameter 1 parameter 2 parameter 3)

 Getting Started with Thinkphp Three—Framework Templates, Variables (47), thinkphp47_PHP Tutorial[Normal for loop output]

lt:less than   

gt: great than >

eq:equal is equal to

elt:less equal Less than or equal

egt: great equal greater than or equal to

heq: heng equal is equal to

nheq: not heng equal Not equal to

Getting Started with Thinkphp Three—Framework Templates, Variables (47), thinkphp47_PHP Tutorial[Conditional judgment structure]

if judgment

Double branch:

Getting Started with Thinkphp Three—Framework Templates, Variables (47), thinkphp47_PHP Tutorial【Range Judgment】

in between

in tag using

Getting Started with Thinkphp Three—Framework Templates, Variables (47), thinkphp47_PHP Tutorial【Constant equal】

Getting Started with Thinkphp Three—Framework Templates, Variables (47), thinkphp47_PHP Tutorial

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1014833.htmlTechArticleThinkphp Getting Started Three - Framework Templates, Variables (47), thinkphp47 [Calling the template in the controller] display() call The template display (name) of the current operation name calls the template text of the specified name...

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn