PHP. MVC template tag system (3)

Source: Internet
Author: User
PHP. after the MVC tag syntax is introduced, we can now look at the syntax of the template tag system. before looking at the specific tag, we should define what serves as our tag. to write a tag, we apply @... @ tag node. left tag

  PHP. MVC label syntax

After the basic introduction, we can now look at the syntax of the template tag system.

Before looking at the specific tag, we should define what serves as our tag. to write a tag, we apply <@... @> tag node. the left tag (<@) and right tag (@>) are default labels. if necessary, these labels can be redefined in phpmvc-config.xml.

The template tag system now supports the following three types of labels: including commands, declarations, and expressions. let's take a look at these commands.

Include commands

The include command separates content into many modules, such as the header, footer, or content. the contained page can be HTML or other tag template pages. for example, the following include command can be used to contain a header:

<@ Include 'pageheader. SS' @>

An example of a template containing commands is as follows:



...











... ...

<@ Include 'pageheader. SS' @>

...


In this example, the content of the pageHeader. ssp header file will be inserted into the home page and sent to the user's browser. this header file contains an expression:


 
<@ = ViewConfig. getAppTitle @>
 

This expression will be compiled and output at runtime as follows:


 
Flash Jacks 'sleek Tab Site
 

Statement

The declaration promises to declare a page-level variable in the template, or even other include pages. a declaration looks like the following code:

<@ SalesAreaID = 'central District '@>

We can apply the declaration in the template file:

<@ SaleMonth = data. getValueBean ('sale _ month') @>
<@ SaleTitle = data. getValueBean ('sale _ title') @>
<@ DealHeading = data. getValueBean ('dest_heading ') @>
<@ SalesAreaID = 'central District '@>




<BR>... <BR>


...

In this example, we declare some page variables. the first three variables have been assigned a value in the ActionObject of the Action class we created: data. getValueBean ('sale _ month '). the first variable is assigned a string value: salesAreaID = 'central District '.

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.