Home Backend Development PHP Tutorial PHP.MVC的模板标签系统之标签行为调度_PHP

PHP.MVC的模板标签系统之标签行为调度_PHP

Jun 01, 2016 pm 12:34 PM
deal with Label template system Scheduling

MVC

TagActionDispatcher是一个标准的ActionDispatcher类的实现,它支持访问基本模板标签。TagActionDispatcher类支持相同的ActionObjects集合和ViewResourcesConfig属性作为默认的ActionDispatcher。TagActionDispatcher类能被用在带有或没有带有模板标签系统上,尽管由于它的额外处理会造成小的性能下降。

  模板标签库是PHP。MVC框架结构的子系统,模板标签库联合TagActionDispatcher一起工作来支持一些简单的模板标签。

  下面的图表显示了PHP。MVC模板标签系统的总揽。左边展示的是模板标签系统的程序流程。右边是TagActionDispatcher的程序流程,还有标签模板是怎样使这些类进行交互。

PHP.MVC的模板标签系统之标签行为调度



  1、初始化

  当控制器传递控制到达TagActionDispatcher,一些初始化触发去设置ActionObjects和ViewResourcesConfig属性为了使用我们的模板:
从request中重新获得$form,$errors和$data对象,如果这些对象中的任意一个已经在之前被创建(比如在Action类中),那么对象现在将在资源模板中不可见,否则对象将被设置为NULL。

  重新获得ViewResourcesConfig对象的参考,它包含了配置参数。

  设置在ViewResourcesConfig参数中指向模板源文件和编译的模板文件的路径。

  2、设置标签页面

  模板源文件的扩展名(可能是"。ssp")被用来和ViewResourcesConfig->tagFlagStr参数相比较来决定是否这个页面需要处理,否则页面将被处理为标准(无标签)模板文件。我们能在view-resources元素中配置标签文件扩展名,就像这样:

<view-resources
...
tagFlagStr = "。ssp"
tagFlagCnt = "-4"
...
</view-resources>

  tagFlagStr指示了标签模板源文件能被预处理,比如:myPage。ssp。这个扩展名触发标签处理。属性tagFlagCnt定义了文件名结尾的字符数,包括"。"(xxxYyy。ssp)。据个例子,-4代表源文件名最后4个字符。默认值是。ssp和-4,因此如果我们使用一个模板文件名像myPage。ssp,我们不需要设置这些参数。

  3、处理标签文件

  模板标签系统决定是否运行标签处理器,要根据ViewResourcesConfig->processTags属性。如果这个属性为真,模板页(及它所包含的页)将被标签处理器类所处理,否则标签处理器不会被调用。开发者只要将它在开发中将其设置为真即可,假则不处理。但要注意的是当processTags属性设置为真,修改过的标签页才会被编译(这依赖于compileAll属性设置)。我们能定义processTags属性在view-resources元素,就像这样:

<view-resources
...
processTags = "True"
...
</view-resources>

  注意,它的默认值是假。

  4、编译模板页。

  如果TagActionDispatcher决定模板页将被处理,那么它会传递控制给模板标签系统。现在模板标签系统将决定是否只编译修改过的页,还是编译所有页。这种行为使用ViewResourcesConfig->compileAll属性来定义。我们定义compileAll属性就像这样:

<view-resources
...
compileAll = "True"
...
</view-resources>

  这个属性默认为假。

  5、只编译修改的页

  如果compileAll属性设置为假(默认值),那么只会编译修改过的页。据个例子,如果被请求的页面自从上次被请求以来被修改过,此页将会被编译。

  6、编译所有的页

  如果compileAll属性设置为真,模板标签系统将总是编译页面(包括包含的页面)无论此页面自从上次请求以来是否修改过。开发者使用在开发中使用这个选项能够保证所有的页面都被处理。

  7、处理VIEW资源

  在处理完模板页之后,控制权回到TagActionDispatcher。被请求的VIEW资源(模板文件)将被任何其他的正规PHP。MVC模板文件所处理。TagActionDispatcher重新获得被编译的页(包括包含的页面)并且将页面输出给用户的浏览器。如果模板标签系统没有被调用,TagActionDispatcher将被请求的页面作为正规的VIEW资源来处理。比如TagActionDispatcher能被用来代替标准的ActionDispatcher。
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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

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

The operation process of WIN10 service host occupying too much CPU The operation process of WIN10 service host occupying too much CPU Mar 27, 2024 pm 02:41 PM

1. First, we right-click the blank space of the taskbar and select the [Task Manager] option, or right-click the start logo, and then select the [Task Manager] option. 2. In the opened Task Manager interface, we click the [Services] tab on the far right. 3. In the opened [Service] tab, click the [Open Service] option below. 4. In the [Services] window that opens, right-click the [InternetConnectionSharing(ICS)] service, and then select the [Properties] option. 5. In the properties window that opens, change [Open with] to [Disabled], click [Apply] and then click [OK]. 6. Click the start logo, then click the shutdown button, select [Restart], and complete the computer restart.

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

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

Learn how to handle special characters and convert single quotes in PHP Learn how to handle special characters and convert single quotes in PHP Mar 27, 2024 pm 12:39 PM

In the process of PHP development, dealing with special characters is a common problem, especially in string processing, special characters are often escaped. Among them, converting special characters into single quotes is a relatively common requirement, because in PHP, single quotes are a common way to wrap strings. In this article, we will explain how to handle special character conversion single quotes in PHP and provide specific code examples. In PHP, special characters include but are not limited to single quotes ('), double quotes ("), backslash (), etc. In strings

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

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.

See all articles