PHP.MVC template tag system (1)_PHP tutorial
Jul 21, 2016 pm 04:12 PM
??? PHP.MVC的模板標(biāo)簽系統(tǒng)(PhpMVC_Tags)現(xiàn)在提供了3種類(lèi)型的標(biāo)簽:包含指令,聲明和表達(dá)式.
??? 包含指令能讓我們將內(nèi)容分隔為許多模塊,比如:頁(yè)眉,頁(yè)腳或者內(nèi)容.包含的頁(yè)面可以是HTML,或者其他標(biāo)簽?zāi)0屙?yè).據(jù)個(gè)例子,下面的包含指令能用來(lái)包含一個(gè)頁(yè)眉:
??? <@ include 'pageHeader.ssp' @>
??? 聲明允許我們?cè)谀0宸N聲明一個(gè)頁(yè)面級(jí)別的變量,或者甚至其他包含頁(yè)面.一個(gè)聲明看起來(lái)像以下代碼:
??? <@ salesAreaID = "Central District" @>
??? 表達(dá)式標(biāo)簽允許我們?cè)谀0屙?yè)中執(zhí)行表達(dá)式.表達(dá)式的結(jié)果將被包含進(jìn)模板頁(yè).以下表達(dá)式將被用來(lái)顯示一個(gè)簡(jiǎn)單的字符串(salesAreaID),也可以找回框架配置類(lèi)的屬性:
??? <@ =salesAreaID @>
??? <@ =viewConfig.getAreaManager @>
??? PHP.MVC beta 0.4.0引進(jìn)了一個(gè)新配置類(lèi)叫做ViewResourcesConfig.這個(gè)類(lèi)能被用來(lái)定義能被用在VIEW資源(模板)中的全局參數(shù),并且也能去配置模板標(biāo)簽系統(tǒng),它將在下面顯示.phpmvc-config.xml配置文件中的view-resources元素在下面的顯示:
???
copyright = "Copyright @ 2010 Flash Jack. All rights reserved."
contactInfo = "flash.jack@jackshost.com"
processTags = "true"
compileAll = "true"
className = "MyViewResourcesConfig">
??????
??????
???
??? 模板頁(yè)面處理使用模板標(biāo)簽系統(tǒng)能被
???
?? processTags = "true"
?? compileAll? = "true"
?? ...
???
Action Dispatcher
??? PHP.MVC版本beta 0.4.0以上ActionDispatcher類(lèi)用來(lái)負(fù)責(zé)使FormBean,Errors,Value(商務(wù)數(shù)據(jù))和ViewResourcesConfig對(duì)象在我們的VIEW(模板)中可以使用.
??? 在檢查模板標(biāo)簽系統(tǒng)之前我們應(yīng)該快速的看一下ActionObjects和ViewResourcesConfig類(lèi),當(dāng)在使用標(biāo)準(zhǔn)的ActionDispatcher時(shí).
ActionObjects
??? ActionDispatcher使一些對(duì)象在我們所使用的模板頁(yè)面中的應(yīng)用程序VIEW資源可用.3種標(biāo)準(zhǔn)的ActionObjects為:FormBean,Errors,和Value(商務(wù)數(shù)據(jù))對(duì)象.
??? 一下表格顯示了在FormAction和Action類(lèi)中如何使用FormBean,Errors和Value對(duì)象:
??? Saving ActionObjects in ActionForm Classes?
?ActionErrors? $this->saveErrors($request, $actionErrors)?
?FormBeans? $this->saveFormBean($request, $this)?
?ValueObjects? $this->saveValueObject($request, $valueObject)?
??? Saving ActionObjects in Action Classes?
?ActionErrors? $this->saveErrors($request, $actionErrors)?
?FormBeans? $this->saveFormBean($request, $form)?
?ValueObjects? $this->saveValueObject($request, $valueObject)?
??? Retrieving ActionObjects in View Resources (Templates)?
?ActionErrors? $errors->getItemString('logon_username_reqd')?
?FormBeans? $form->username?
?ValueObjects? $data->salesNorth?
??? 一個(gè)ActionObject將被初始化為NULL如果對(duì)象沒(méi)有在之前被創(chuàng)建和保存.要想得到ActionObjects的詳細(xì)信息請(qǐng)看這里:http://www.phpmvc.net/docs/guides/guidesIdx.php?doc=action-objects
View Resources
ActionDispatcher can also expose ViewResourcesConfig objects to our template pages. The ViewResourcesConfig object is configured by the
The following code shows how to access the ViewResourcesConfig property in our HTML header template using expressions from the template tag system:
<@ =viewConfig.getAppTitle @>
Configure Action Dispatcher
ActionDispatcher is the default PHP.MVC (in beta 0.4.0 and above) Dispatcher class. This Action Dispatcher is included in the framework and will be used by default unless we define a class to replace the Dispatcher class. In the next section we will We will see how to configure our application to use an alternative class - the TagActionDispatcher class.

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

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

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

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

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

Recently, Huawei announced that it will launch a new smart wearable product equipped with Xuanji sensing system in September, which is expected to be Huawei's latest smart watch. This new product will integrate advanced emotional health monitoring functions. The Xuanji Perception System provides users with a comprehensive health assessment with its six characteristics - accuracy, comprehensiveness, speed, flexibility, openness and scalability. The system uses a super-sensing module and optimizes the multi-channel optical path architecture technology, which greatly improves the monitoring accuracy of basic indicators such as heart rate, blood oxygen and respiration rate. In addition, the Xuanji Sensing System has also expanded the research on emotional states based on heart rate data. It is not limited to physiological indicators, but can also evaluate the user's emotional state and stress level. It supports the monitoring of more than 60 sports health indicators, covering cardiovascular, respiratory, neurological, endocrine,

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.

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

The official website for downloading the Linux Chinese operating system is committed to providing users with a simple and efficient download experience. Below are some frequently asked questions and answers for your reference. 1.What is the official Chinese download website for Linux system? The official Chinese download website of the Linux system is the official resource platform for the Chinese version of the Linux operating system for the majority of users. In this online community, you can easily obtain various Linux system versions and freely choose and download them. 2. Why choose the Chinese version of Linux system? The Chinese version of Linux is specially designed to meet the needs of Chinese users. Its interface and applications are all presented in Chinese, which is more in line with the daily habits of Chinese users. In addition, this version
