The initial knowledge of the template tag system of PHP. MVC

Source: Internet
Author: User
PHP. MVC's template tag system (PhpMVC_Tags) now provides three types of tags: including commands, declarations, and expressions. The include command separates content into many modules, such as the header, footer, or content. the contained page can be HTML or PHP. the MVC template tag system (PhpMVC_Tags) now provides three types of tags: including commands, declarations, and expressions.

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' @>


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 '@>


The expression tag promises to fulfill the expression on the template page. the expression result is included in the template page. the following expression is used to display a simple string (salesAreaID). You can also retrieve the attributes of the framework configuration class:

<@ = SalesAreaID @>
<@ = ViewConfig. getAreaManager @>


PHP. MVC beta 0.4.0 introduces a new configuration class called ViewResourcesConfig. this class can be used to define global parameters that can be used in VIEW resources (templates), and can also be used to configure the template tag system, which will be shown below. the view-resources element in the phpmvc-config.xml configuration file is displayed below:

<View-resources
AppTitle = 'flash Jacks' Sleek Tab site'
Copyright = 'copyright @ 2010 Flash Jack. All rights reserved .'
ContactInfo = 'flash. jack@jackshost.com'
ProcessTags = 'true'
CompileAll = 'true'
ClassName = 'myviewresourcesconfig'>
<! -- We can set some properties on our custom ViewResourcesConfig class -->
<Set-property = 'areamanager 'value = 'Joe J. Blogs Esq.'/>
</View-resources>


The template page processing application Template tag system can be controlled by <view-resources> nodes. first, we can define whether the template tag system has compiled all template pages or only compiled and corrected pages. second, we can define whether the template tag system really needs to process the tag page. processing the tag page is useful when and after the configuration using the program configuration. the <view-resources> shown in the following unit sets the compileAll and processTags attributes to true (always process the tab and process all tabs ):

<View-resources
...
ProcessTags = 'true'
CompileAll = 'true'
...
</View-resources>


Action Dispatcher

The ActionDispatcher class above PHP. MVC beta 0.4.0 is used to apply FormBean, Errors, Value (business data), and ViewResourcesConfig objects in our VIEW (template.

Before checking the template tag system, we should take a quick look at the ActionObjects and ViewResourcesConfig classes when performing ActionDispatcher at the application scale.

ActionObjects

ActionDispatcher makes some objects available in the template page of our application using the program VIEW resource. The three types of ActionObjects are: FormBean, Errors, and Value (Business Data) objects.

The following table shows how to apply FormBean, Errors, and Value objects in the FormAction and Action classes:

Saving ActionObjects in ActionForm Classes

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.