php.MVC’s template tag system (PhpMVC_Tags) now provides 3 types of tags: include directives, declarations and expressions. processTags = "true"
Include directives allow us to separate content into many modules, such as: header, footer or content The included page can be HTML, or other tag template pages. For example, the following include directive can be used to include a page header:
<@ include 'pageHeader.ssp' @>
The declaration allows us to include Declare a variable at the page level, or even other containing pages. A declaration would look like the following code:
<@ salesAreaID = "Central District" @>
The expression tag allows us to perform expressions in the template page. Expressions The results will be included in the template page. The following expression will be used to display a simple string (salesAreaID), and can also retrieve the properties of the framework configuration class:
<@ =salesAreaID @>
<@ = viewConfig.getAreaManager @>
PHP.MVC beta 0.4.0 introduces a new configuration class called ViewResourcesConfig. This class can be used to define global parameters that can be used in VIEW resources (templates), and can also configure templates Tag system, it will be displayed below. The view-resources element in the .phpmvc-config.xml configuration file is displayed below:
copyright = "Copyright @ 2010 Flash Jack. All rights reserved."
contactInfo = "flash.jack@jackshost.com" PRocessTags = "true" compileAll = -- We can SET SOME Properties on Our Custom ViewResourceSconfig Class-& GT;
& LT; SET-PROPERTY = "Areamanager" Value = "Joe J. Blogs ESQ."/& GT; & Lt;/view-resources & gt;
template page processing use template The tag system can be controlled by the
compileAll = "true"
...
Action Dispatcher
PHP.MVC version beta 0.4.0 or above ActionDispatcher class is responsible for Make the FormBean, Errors, Value (business data) and ViewResourcesConfig objects available in our VIEW (template).
Before checking the template tag system we should take a quick look at the ActionObjects and ViewResourcesConfig classes when using the standard ActionDispatcher.
ActionObjects
The following table shows the functions in FormAction How to use FormBean, Errors and Value objects in Action classes:
Saving ActionObjects in ActionForm Classes
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)
ActionErrors $errors->getItemString('logon_username_reqd')
FormBeans $form->username
ValueObjects $ data->salesNorth
An ActionObject will be initialized to NULL if the object has not been previously created and saved. For more information on ActionObjects see here: 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:
Class. The Action Dispatcher included in the framework will be used by default unless we define a class to replace the Dispatcher class. In the next section we will see how to configure our application to use an alternative class - the TagActionDispatcher class.
The above is the content of PHP.MVC’s template tag system (1). For more related articles, please pay attention to the PHP Chinese website (www.php.cn)!