Home Backend Development PHP Tutorial PHP.MVC template tag system (2)_PHP tutorial

PHP.MVC template tag system (2)_PHP tutorial

Jul 21, 2016 pm 04:12 PM
action tag the two Label template of system

The Php.MVC Tag Action Dispatcher

TagActionDispatcher is an implementation of the 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. The TagActionDispatcher class can be used with or without a template tag system Although there will be a small performance drop due to its extra processing.
The template tag library is a subsystem of the PHP.MVC framework. The template tag library works together with TagActionDispatcher to support some simple template tags.
Below The diagram shows an overview of the PHP.MVC template tag system. The left side shows the program flow of the template tag system. The right side shows the program flow of TagActionDispatcher, and how the tag template enables these classes to interact.

模板标签系统的程序流程 

1. Initialization
When the controller passes control to the TagActionDispatcher, some initialization is triggered to set the ActionObjects and ViewResourcesConfig properties in order to use our template:
Retrieve the $form, $errors and $data objects from the request, If any of these objects have been created before (such as in the Action class), then the object will now not be visible in the resource template, otherwise the object will be set to NULL.
Regain the reference to the ViewResourcesConfig object, which Contains configuration parameters.
Set the path to the template source file and compiled template file in the ViewResourcesConfig parameter.
2. Set the label page
The extension of the template source file (may be ".ssp") Is used to compare with the ViewResourcesConfig->tagFlagStr parameter to determine if this page needs to be processed, otherwise the page will be processed as a standard (untag) template file. We can configure the tag file extension in the view-resources element, like Like this:
...
tagFlagStr = ".ssp"
tagFlagCnt = "-4"
...

tagFlagStr indicates that the tag template source file can be preprocessed, such as: myPage.ssp. This extension triggers tag processing. The attribute tagFlagCnt defines the number of characters at the end of the file name, including "." (xxxYyy.ssp). Data For example, -4 represents the last 4 characters of the source file name. The default values ​​are .ssp and -4, so if we use a template file name like myPage.ssp, we do not need to set these parameters.
3. Process tags File
The template tag system decides whether to run the tag processor based on the ViewResourcesConfig->processTags attribute. If this attribute is true, the template page (and the pages it contains) will be processed by the tag processor class, otherwise the tag The processor will not be called. Developers only need to set it to true during development, otherwise it will not be processed. But it should be noted that when the processTags attribute is set to true, the modified tag page will be compiled ( This depends on the compileAll attribute setting). We can define the processTags attribute on the view-resources element, like this:
...
processTags = "True"
.. .

Note that its default value is false.
4. Compile the template page.
If TagActionDispatcher decides that the template page will be processed, then it will pass control to Template tag system. Now the template tag system will decide whether to compile only modified pages, or compile all pages. This behavior is defined using the ViewResourcesConfig->compileAll attribute. We define the compileAll attribute like this:
...
compileAll = "True"
...

This attribute defaults to false.
5. Only compile the modified ones Page.
If the compileAll attribute is set to false (the default value), then only modified pages will be compiled. For example, if the requested page has been modified since the last time it was requested, this page will be compiled. .
6. Compile all pages.
If the compileAll attribute is set to true, the template tag system will always compile the page (including included pages) regardless of whether the page has been modified since the last request. Developers use Using this option during development can ensure that all pages are processed.
7. Process VIEW resources.
After processing the template page, control returns to TagActionDispatcher. The requested VIEW resource (template file) will Processed by any other regular PHP.MVC template file. TagActionDispatcher retrieves the compiled page (including the containing page) and outputs the page to the user's browser. If the template tag system is not called, TagActionDispatcher will be the requested page Processed as a regular VIEW resource. For example, TagActionDispatcher can be used instead of the standard ActionDispatcher.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/313707.htmlTechArticleThe Php.MVC Tag Action Dispatcher TagActionDispatcher is an implementation of the standard ActionDispatcher class, which supports access to basic template tags. The TagActionDispatcher class supports the same ActionObje...
Statement of this Website
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

CUDA's universal matrix multiplication: from entry to proficiency! CUDA's universal matrix multiplication: from entry to proficiency! Mar 25, 2024 pm 12:30 PM

General Matrix Multiplication (GEMM) is a vital part of many applications and algorithms, and is also one of the important indicators for evaluating computer hardware performance. In-depth research and optimization of the implementation of GEMM can help us better understand high-performance computing and the relationship between software and hardware systems. In computer science, effective optimization of GEMM can increase computing speed and save resources, which is crucial to improving the overall performance of a computer system. An in-depth understanding of the working principle and optimization method of GEMM will help us better utilize the potential of modern computing hardware and provide more efficient solutions for various complex computing tasks. By optimizing the performance of GEMM

Huawei's Qiankun ADS3.0 intelligent driving system will be launched in August and will be launched on Xiangjie S9 for the first time Huawei's Qiankun ADS3.0 intelligent driving system will be launched in August and will be launched on Xiangjie S9 for the first time Jul 30, 2024 pm 02:17 PM

On July 29, at the roll-off ceremony of AITO Wenjie's 400,000th new car, Yu Chengdong, Huawei's Managing Director, Chairman of Terminal BG, and Chairman of Smart Car Solutions BU, attended and delivered a speech and announced that Wenjie series models will be launched this year In August, Huawei Qiankun ADS 3.0 version was launched, and it is planned to successively push upgrades from August to September. The Xiangjie S9, which will be released on August 6, will debut Huawei’s ADS3.0 intelligent driving system. With the assistance of lidar, Huawei Qiankun ADS3.0 version will greatly improve its intelligent driving capabilities, have end-to-end integrated capabilities, and adopt a new end-to-end architecture of GOD (general obstacle identification)/PDP (predictive decision-making and control) , providing the NCA function of smart driving from parking space to parking space, and upgrading CAS3.0

After 2 months, the humanoid robot Walker S can fold clothes After 2 months, the humanoid robot Walker S can fold clothes Apr 03, 2024 am 08:01 AM

Editor of Machine Power Report: Wu Xin The domestic version of the humanoid robot + large model team completed the operation task of complex flexible materials such as folding clothes for the first time. With the unveiling of Figure01, which integrates OpenAI's multi-modal large model, the related progress of domestic peers has been attracting attention. Just yesterday, UBTECH, China's "number one humanoid robot stock", released the first demo of the humanoid robot WalkerS that is deeply integrated with Baidu Wenxin's large model, showing some interesting new features. Now, WalkerS, blessed by Baidu Wenxin’s large model capabilities, looks like this. Like Figure01, WalkerS does not move around, but stands behind a desk to complete a series of tasks. It can follow human commands and fold clothes

Which version of Apple 16 system is the best? Which version of Apple 16 system is the best? Mar 08, 2024 pm 05:16 PM

The best version of the Apple 16 system is iOS16.1.4. The best version of the iOS16 system may vary from person to person. The additions and improvements in daily use experience have also been praised by many users. Which version of the Apple 16 system is the best? Answer: iOS16.1.4 The best version of the iOS 16 system may vary from person to person. According to public information, iOS16, launched in 2022, is considered a very stable and performant version, and users are quite satisfied with its overall experience. In addition, the addition of new features and improvements in daily use experience in iOS16 have also been well received by many users. Especially in terms of updated battery life, signal performance and heating control, user feedback has been relatively positive. However, considering iPhone14

Always new! Huawei Mate60 series upgrades to HarmonyOS 4.2: AI cloud enhancement, Xiaoyi Dialect is so easy to use Always new! Huawei Mate60 series upgrades to HarmonyOS 4.2: AI cloud enhancement, Xiaoyi Dialect is so easy to use Jun 02, 2024 pm 02:58 PM

On April 11, Huawei officially announced the HarmonyOS 4.2 100-machine upgrade plan for the first time. This time, more than 180 devices will participate in the upgrade, covering mobile phones, tablets, watches, headphones, smart screens and other devices. In the past month, with the steady progress of the HarmonyOS4.2 100-machine upgrade plan, many popular models including Huawei Pocket2, Huawei MateX5 series, nova12 series, Huawei Pura series, etc. have also started to upgrade and adapt, which means that there will be More Huawei model users can enjoy the common and often new experience brought by HarmonyOS. Judging from user feedback, the experience of Huawei Mate60 series models has improved in all aspects after upgrading HarmonyOS4.2. Especially Huawei M

Differences and similarities of cmd commands in Linux and Windows systems Differences and similarities of cmd commands in Linux and Windows systems Mar 15, 2024 am 08:12 AM

Linux and Windows are two common operating systems, representing the open source Linux system and the commercial Windows system respectively. In both operating systems, there is a command line interface for users to interact with the operating system. In Linux systems, users use the Shell command line, while in Windows systems, users use the cmd command line. The Shell command line in Linux system is a very powerful tool that can complete almost all system management tasks.

DJI Osmo Action 5 Pro: Release date mooted as retailer reveals launch pricing that could undercut GoPro Hero 13 Black DJI Osmo Action 5 Pro: Release date mooted as retailer reveals launch pricing that could undercut GoPro Hero 13 Black Sep 04, 2024 am 06:51 AM

DJI has not confirmed any plans to introduce a new action camera yet. Instead, it seems that GoPro will get ahead of its rival this year, having teased that it will introduce two new action cameras on September 4. For context, these are expected to a

Detailed explanation of how to modify system date in Oracle database Detailed explanation of how to modify system date in Oracle database Mar 09, 2024 am 10:21 AM

Detailed explanation of the method of modifying the system date in the Oracle database. In the Oracle database, the method of modifying the system date mainly involves modifying the NLS_DATE_FORMAT parameter and using the SYSDATE function. This article will introduce these two methods and their specific code examples in detail to help readers better understand and master the operation of modifying the system date in the Oracle database. 1. Modify NLS_DATE_FORMAT parameter method NLS_DATE_FORMAT is Oracle data

See all articles