Home > php教程 > PHP开发 > body text

PHP.MVC template tag system (5)

黄舟
Release: 2016-12-17 10:15:20
Original
1144 people have browsed it

Build a template tag system application

It only takes a few steps to build a template tag system application.
Note: The following steps assume the use of the new SleeK example application (this example can be found at www.phpmvc.net).

Modify the application's boot.ini file

The application's boot.ini file contains the information needed to obtain the PHP.MVC framework. The boot.ini file is usually located in the "WEB-INF" directory of the application. In order to set up the application, use For the template tag class, we need to define some properties in the boot.ini file.

TagActionDispatcher class

TagActionDispatcher is the standard implementation of the ActionDispatcher class. In order for the framework to read the TagActionDispatcher class, we set the value of the variable $appServerRootDir to 'TagActionDispatcher' :
// Setup the application specific ActionDispatcher (RequestDispatcher)
$actionDispatcher = 'TagActionDispatcher';

Template tag system library root directory

We also need to set the path to point to our PHP.MVC library (requires the absolute path of the file system) :
// Set php.MVC library root directory (no trailing slash).
$appServerRootDir = 'C:WWWphpmvc-base';

Optional settings

The application timer can be set on or off using the $timerRun attribute :
// Timer reporting. 1=on, 0=off
$timerRun = 1;
You can also instruct the framework to always (force) compile the application phpmvc-config.xml configuration class (best used in the development stage, because it will Slower), we use:
// The application XML configuration data set:
$appXmlCfgs = array();
$appXmlCfgs['config'] = array('name'=>'phpmvc-config.xml', 'fc'=>True);
Or only recompile the application configuration file when the phpmvc-config.xml file is modified (use this setting after development is completed, it is faster), we use:
// The application XML configuration data set:
$appXmlCfgs = array();
$appXmlCfgs['config'] = array('name'=>'phpmvc-config.xml', 'fc'=>False);

Setting up the application template directory

When setting up the template directory for a template tag application, we need to create a directory (and subdirectories) to place our application template files. This directory must be named $ in the View resource configuration class The value defined by the tplDir attribute defaults to './WEB-INF/tpl'. For example: the example application has a template directory structure set up like this:
- PhpMVC-Tags
  Index.html
  Main.php
  WEB-INF G TPL
PAGEFOOTER.SSP
PAGEHEADER.SSP
SalePageBody.ssp
Sale
PageContent.ssp
We also need to create a pages compiled by the directory. Value. The default is './WEB-INF/tpl_C'. The example application has a template directory structure set up like this:
PhpMVC-Tags
  Index.html
  Main.php
  WEB-INF
   tpl
   ...
    sale _ ... p TPL_C
PAGEFOOTER.SSPC
PAGEHEADER.SSPC
SalepageBody.sspc
sale
pageContent.sspc
We also need to create sale directory under './web-inf/tpl_c'. Library paths and inclusions

Check that the following path settings have been defined in the GlobalPaths.php and globalPRepend.php files in the "/WEB-INF" directory of your framework installation directory:
GlobalPaths.php

----- --------------------------------------------------

$appDirs[] = ' WEB-INF/lib/phpmvc_tags';

globalPrepend.php
---------------------------------- -------------
include_once 'PhpMVC_Tags.php';
If they are not added to the path, then define these variables.

Install the PHP.MVC library

Download the latest version of the PHP.MVC library: http://www.phpmvc.net/download/cvsIdx.php?doc=cvs-snaps
Unzip the library document to a directory. Modify the path settings and include settings described above .

Run the example application

Download the example application. The complete example code file and this wizard can be downloaded here: http://www.phpmvc.net/download/rel/phpmvc-tags-v1.0. zip
Extract to the web server directory. It may look like this: C:/WWW/PhpMVC-Tags
Modify the application and framework settings.
In order to test the example program, you need the homepage of the browser example program: http://localhost/PhpMVC -Tags/Index.html


Appendix A: ViewResources configuration class

The ViewResourcesConfig class represents the configuration information of the element.
The following table lists the attributes, item descriptions and default values ​​of the ViewResourcesConfig class:

PHP.MVC template tag system (5)

The above is the content of PHP.MVC’s template tag system (5). For more related articles, please pay attention to the PHP Chinese website (www.php.cn)!


Related labels:
source:php.cn
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template