Php. MVC template Tagging System (v)

Source: Internet
Author: User
Tags define config file system include ini php and resource root directory

Creating a template Tag System application

Creating a template Tag System application takes only a few steps.
Note: The following steps assume the use of a new sleek example application (this example can be found on www.phpmvc.net ).

Modifying an application's Boot.ini file

The application's Boot.ini file contains information that needs to be PHP.MVC framework. Boot.ini files are typically located in the application's "Web-inf" directory. To set up the application to use 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 have the variable $ Appserverrootdir set value to ' Tagactiondispatcher ':
Setup the Application specific Actiondispatcher (RequestDispatcher)
$actionDispatcher = ' Tagactiondispatcher ';

Template label system Library root directory

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

Optional settings

The application timer can be set on or off using the $timerrun property:
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 (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);

To set the application template directory

When setting the template directory for the template label application, we need to create a directory (and subdirectories) and place our application template files. This directory must be named the value defined by the $tpldir property of the View resource configuration class, and the default is './web-inf/tpl '. For example: Example application has a template directory structure setting 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 directories to place compiled pages. This directory must be named as the value defined by the $tpldirc property of the view resource configuration class. The default is './web-inf/tpl_c '. Example application has a template directory structure setting 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 to the PHP.MVC library and include

Check that the following path settings have been defined in the globalpaths.php and globalprepend.php files under your framework installation directory under the "/web-inf" 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.

Installing the PHP.MVC Library

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

Running the example application

Download the example application. Complete sample code files and this wizard can be downloaded here: Http://www.phpmvc.net/download/rel/phpmvc-tags-v1.0.zip
Extract to the Web server directory. Maybe like this: C:/www/phpmvc-tags
Modify application and framework settings.
In order to test the example program, need the browser Example program homepage: http://localhost/PhpMVC-Tags/Index.html


Appendix A:viewresources Configuration Class

The Viewresourcesconfig class shows the configuration information for the <view-resource> element.
The following table lists the properties of the Viewresourcesconfig class, the entry description, and the default values:

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 is pre-processed. Eg: "MYPAGE.SSP" '. SSP '
$tagFlagCnt The number of trailing filename characters to sample (". SSP" =-4) -4

Turn from: Dynamic Network production guide www.knowsky.com

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.