Php. MVC template tagging System (ii)

Source: Internet
Author: User
Tags resource

The Php.mvc Tag Action Dispatcher

Tagactiondispatcher is the implementation of a standard Actiondispatcher class that supports access to basic template tags. The Tagactiondispatcher class supports the same Actionobjects collection and Viewresourcesconfig properties as the default Actiondispatcher.tagactiondispatcher class can be used with or without a template tag system , although small performance declines due to its extra processing.
Template Tag Library is a subsystem of PHP.MVC frame structure. Template Tag Library Federated Tagactiondispatcher works together to support some simple template tags.
The following chart shows an overview of the Php.mvc template tagging system. The left side shows the program flow of the template label system. The right side is the Tagactiondispatcher program flow and how the label template interacts with the classes.

1. Initialize
When controller delivery control arrives at Tagactiondispatcher, some initialization triggers to set the Actionobjects and Viewresourcesconfig properties in order to use our template:
Re-obtain $form, $errors, and $data objects from the request, if any of these objects have been created before (for example, in the Action Class), the object will now be invisible in the resource template, or the object will be set to null.
Re-obtain the reference for the Viewresourcesconfig object, which contains the configuration parameters.
Sets the path to the template source file and the compiled template file in the Viewresourcesconfig parameter.
2. Set the label page
The extension of the template source file (possibly ". SSP") is used to compare the VIEWRESOURCESCONFIG->TAGFLAGSTR parameter to determine if the page needs to be processed, otherwise the page will be processed as a standard (no label) Template file. We can configure the tag file name extension in the view-resources element, like this:
<view-resources
...
Tagflagstr = ". SSP"
tagflagcnt = "-4"
...
</view-resources>
TAGFLAGSTR indicates that the label template source file can be preprocessed, such as: MYPAGE.SSP. This extension triggers tag processing. Property TAGFLAGCNT defines the number of characters at the end of the file name, including the. (XXXYYY.SSP). For example, 4 represents the last 4 characters of the source file name. The default is. SSP and-4, so if we use a template filename like MYPAGE.SSP, we don't need to set these parameters.
3. Process Tag File
The template label system determines whether to run the label processor, depending on the Viewresourcesconfig->processtags property. If this property is true, the template page (and the pages it contains) will be processed by the label processor class. Otherwise, the label processor will not be invoked. The developer simply sets it to true in development and does not deal with it. But note that when the Processtags property is set to True, the Modified tab is compiled (depending on the Compileall property setting). We can define the Processtags attribute in the view-resources element, just like this:
<view-resources
...
Processtags = "True"
...
</view-resources>
Note that its default value is False.
4. Compile the template page.
If Tagactiondispatcher decides that the template page will be processed, it will pass control to the template tag system. Now the template label system will decide whether to compile only modified pages or all pages. This behavior uses viewresourcesconfig-> The Compileall attribute is defined. We define the Compileall property like this:
<view-resources
...
Compileall = "True"
...
</view-resources>
This property defaults to False.
5. Compile the modified page only.
If the Compileall property is set to False (the default), only modified pages are compiled. For example, if the requested page has been modified since it was last requested, the page will be compiled.
6. Compile all the pages.
If the Compileall property is set to True, the template label system will always compile the page (including the included pages) regardless of whether the page has been modified since the last request. Developers use this option in development to ensure that all pages are processed.
7. Handle view resources.
After the template page is processed, control returns to Tagactiondispatcher. The requested view resource (template file) will be processed by any other regular Php.mvc template file. Tagactiondispatcher get the compiled page again ( Include pages included) and output the page to the user's browser. If the template label system is not called, Tagactiondispatcher the requested page as a formal view resource. For example, Tagactiondispatcher can be used to replace the standard Actiondispatcher.



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.