Php. _php tutorial on labeling behavior scheduling for the template label system of MVC

Source: Internet
Author: User
Tagactiondispatcher is a standard implementation of the Actiondispatcher class that supports access to basic template tags. The Tagactiondispatcher class supports the same Actionobjects collection and Viewresourcesconfig properties as the default Actiondispatcher. The Tagactiondispatcher class can be used with or without a template label system, although due to its additional processing can result in small performance degradation.
Template tag Library is PHP. The MVC framework structure of the subsystem, template Tag Library Union Tagactiondispatcher work together to support some simple template tags.
The following diagram shows PHP. An overview of the MVC template labeling system. The program flow of the template label system is shown on the left. On the right is the Tagactiondispatcher program flow and how the label template interacts with the classes.


1. Initialization
When the controller delivery control reaches Tagactiondispatcher, some initialization triggers go to set the Actionobjects and Viewresourcesconfig properties in order to use our template:
$form, $errors, and $data objects are obtained from the request, and if any of these objects have been previously created (such as in the Action Class), the object will now be invisible in the resource template, otherwise the object will be set to null.
Re-obtains the reference to 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 (which may be ". SSP ") is used to compare the VIEWRESOURCESCONFIG->TAGFLAGSTR parameter to determine whether 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 extension in the view-resources element, just like this:
<view-resources
...
Tagflagstr = ". ssp
tagflagcnt = "-4"
...
</view-resources>
TAGFLAGSTR indicates that the label template source file can be preprocessed, for example: MyPage. Ssp. This extension triggers the label processing. The Tagflagcnt property defines the number of characters at the end of the file name, including ". "(xxxyyy. SSP). As an example, 4 represents the last 4 characters of the source file name. The default value is. SSP and-4, so if we use a template file name like MyPage. SSP, we do not need to set these parameters.
3. Handling Label files
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 page it contains) will be processed by the label processor class, otherwise the label processor will not be called. Developers simply set it to true in development and leave it out of the process. Note, however, that when the Processtags property is set to True, the Modified tab is compiled (this depends on the Compileall property setting). We can define the Processtags attribute in the view-resources element, just like this:

http://www.bkjia.com/PHPjc/445229.html www.bkjia.com true http://www.bkjia.com/PHPjc/445229.html techarticle Tagactiondispatcher is a standard implementation of the Actiondispatcher class that supports access to basic template tags. The Tagactiondispatcher class supports the same Actionobjects collection and Viewresourcesconfi ...

  • 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.