PHP. MVC template tag system (5)

Source: Internet
Author: User

Create a template tag system application

Only a few steps are required to create a template tag system application.
Note: The following procedure assumes that a new SleeK example application is used (this example can be found at www.phpmvc.net ).

Modify the boot. ini file of the application

Application boot. the INI file must contain PHP. MVC framework information. boot. the INI file is typically located under the "WEB-INF" directory of the application. to set the application to use the template label class, we need. the INI file defines some attributes.

TagActionDispatcher class

TagActionDispatcher is the standard implementation of the ActionDispatcher class. To enable the Framework to read the TagActionDispatcher class, we set the value of $ appServerRootDir to 'tagactiondispatcher ':
// Setup the application specific ActionDispatcher (RequestDispatcher)
$ ActionDispatcher = 'tagactiondispatcher ';

Template tag system database root directory

We also need to set the path to point to our PHP. MVC Library (the absolute path of the file system is required ):
// Set php. MVC library root directory (no trailing slash ).
$ AppServerRootDir = 'C: \ WWW \ phpmvc-base ';

Optional

You can use the $ timerRun attribute to enable or disable an application Timer:
// Timer reporting. 1 = on, 0 = off
$ TimerRun = 1;
You can also guide the framework to always (forcibly) Compile the application phpmvc-config.xml configuration class (preferably in the development phase, because it will be slow), we use:
// The application XML configuration data set:
$ AppXmlCfgs = array ();
$ AppXmlCfgs ['config'] = array ('name' => 'phpmvc-config. xml', 'fc' => True );
Or recompile the application configuration file only when the phpmvc-config.xml file is modified (use this setting after development is complete, fast), we use:
// The application XML configuration data set:
$ AppXmlCfgs = array ();
$ AppXmlCfgs ['config'] = array ('name' => 'phpmvc-config. xml', 'fc' => False );

Set the Application Template directory

When setting the template directory for the template tag application, we need to create a directory (and sub-directory) and place our application template file. this directory must be named as the value defined by the $ tplDir attribute of the View resource configuration class. The default value is '. /WEB-INF/tpl '. for example, the example application has a template directory structure set like this:
-PhpMVC-Tags
Index.html
Main. php
WEB-INF
Tpl
PageFooter. ssp
PageHeader. ssp
SalePageBody. ssp
Sale
PageContent. ssp
We also need to create a directory to place the compiled page. this directory must be named as the value defined by the $ tplDirC attribute of the View resource configuration class. the default value is '. /WEB-INF/tpl_C '. the example application has a template directory structure set like this:
PhpMVC-Tags
Index.html
Main. php
WEB-INF
Tpl
...
Sale
...
Tpl_C
PageFooter. sspC
PageHeader. sspC
SalePageBody. sspC
Sale
PageContent. sspC
Note that we also need to create the sale directory under './WEB-INF/tpl_C.

Set the path and inclusion of the PHP. MVC Library

Check that the following path settings have been defined in the GlobalPaths. php and globalPrepend. php files under the "/WEB-INF" directory under 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, define these variables.

Install the PHP. MVC Library

Download the latest PHP. MVC Library: http://www.phpmvc.net/download/cvsIdx.php? Doc = cvs-snaps
Decompress the library documentation to a directory. Modify the path settings and inclusion settings described above.

Run the example application

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


Appendix A: ViewResources configuration class

The ViewResourcesConfig class displays the configuration information of the <view-resource> element.
The following table lists the attributes, description, and default values of the ViewResourcesConfig class:

Name Description Default Value
$ AppTitle The application title 'My Web application'
$ AppVersion The application version '1. 0'
$ Copyright The copyright notice 'Copyright c yyyy My Name. All rights reserved .'
$ ContactInfo The contact information 'Webmaster @ myhost.com'
$ ProcessTags Do we run the template engine processor (boolean) False
$ CompileAll Force compile pages (boolean) False
$ TagL The left tag identifier '<@'
$ TagR The right tag identifier '">' @>'
$ TplDir The view resource templates directory './WEB-INF/tpl'
$ TplDirC The compiled templates directory './WEB-INF/tpl_C'
$ ExtC The compiled file notation. Eg: "pageContent. ssp [C]" 'C'
$ MaxFileLength The maximum size of the template files allowed, in bytes (integer) 250000
$ TagFlagStr Indicates tag template file (s) to be pre-processed. Eg: "myPage. ssp" '. Ss'
$ TagFlagCnt The number of trailing filename characters to sample (". ssp" =-4) -4

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.