PHP.MVC template tag system (5)_PHP tutorial
Jul 21, 2016 pm 04:12 PM建立模板標簽系統(tǒng)應用程序
??? 建立模板標簽系統(tǒng)應用程序只需幾個步驟.
??? 注意:以下步驟假設使用了新的SleeK例子應用程序(這個例子可以在www.phpmvc.net上找到).
修改應用程序的boot.ini文件
??? 應用程序的boot.ini文件包含需要得到PHP.MVC框架的信息.boot.ini文件通常位于應用程序的"WEB-INF"目錄下.為了設置應用程序使用模板標簽類,我們需要在boot.ini文件中定義一些屬性.
TagActionDispatcher類
??? TagActionDispatcher是ActionDispatcher類的標準實現(xiàn).為了讓框架能讀取TagActionDispatcher類,我們?yōu)樽兞?appServerRootDir設置值為'TagActionDispatcher':
// Setup the application specific ActionDispatcher (RequestDispatcher)
?$actionDispatcher = 'TagActionDispatcher';
模板標簽系統(tǒng)庫根目錄
??? 我們也需要設置路徑指向我們的PHP.MVC庫(需要文件系統(tǒng)的絕對路徑):
// Set php.MVC library root directory (no trailing slash).
?$appServerRootDir = 'C:\WWW\phpmvc-base';
可選設置
??? 應用程序定時器可以使用$timerRun屬性來設置開或關:
// Timer reporting. 1=on, 0=off
?$timerRun = 1;
??? 還可以指導框架總是(強制)編譯應用程序phpmvc-config.xml配置類(最好用在開發(fā)階段,因為會比較慢),我們使用:
// The application XML configuration data set:
? $appXmlCfgs = array();
? $appXmlCfgs['config'] = array('name'=>'phpmvc-config.xml', 'fc'=>True);
??? 或者僅在phpmvc-config.xml文件被修改的時候重新編譯應用程序配置文件(在開發(fā)完成后使用此項設置,速度快),我們使用:
// The application XML configuration data set:
? $appXmlCfgs = array();
? $appXmlCfgs['config'] = array('name'=>'phpmvc-config.xml', 'fc'=>False);
設置應用程序模板目錄
??? 當為模板標簽應用程序設置模板目錄時,我們需要去創(chuàng)建一個目錄(和子目錄),放置我們的應用程序模板文件.這個目錄必須被命名為在View資源配置類的$tplDir屬性所定義的值,默認是'./WEB-INF/tpl'.比如:例子應用程序有一個模板目錄結構設置像這樣:
- PhpMVC-Tags
???? Index.html
???? Main.php
???? WEB-INF
??????? tpl
?????????? pageFooter.ssp
?????????? pageHeader.ssp
?????????? salePageBody.ssp
?????????? sale
????????????? pageContent.ssp
??? 我們也需要去創(chuàng)建目錄放置編譯的頁面.這個目錄必須被命名為在View資源配置類的$tplDirC屬性所定義的值.默認是'./WEB-INF/tpl_C'.例子應用程序有一個模板目錄結構設置像這樣:
PhpMVC-Tags
??? Index.html
??? Main.php
??? WEB-INF
?????? tpl
????????? ...
????????? sale
???????????? ...
????????? tpl_C
???????????? pageFooter.sspC
???????????? pageHeader.sspC
???????????? salePageBody.sspC
???????????? sale
??????????????? pageContent.sspC
??? 注意我們也需要在'./WEB-INF/tpl_C'下創(chuàng)建sale目錄.
設置PHP.MVC庫的路徑和包含
??? 檢查以下路徑設置已經被定義在GlobalPaths.php和globalPrepend.php文件在你的框架安裝目錄下的"/WEB-INF"目錄下:
GlobalPaths.php
------------------------------------------------
?$appDirs[] = 'WEB-INF/lib/phpmvc_tags';
globalPrepend.php
------------------------------------------------
?include_once 'PhpMVC_Tags.php';
??? 如果他們沒有在添加到路徑里,那么就定義這些變量.
安裝PHP.MVC庫
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 described above Settings and including settings.
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
Unzip to In 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
The following table lists the attributes, item descriptions 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" | ?'.ssp' |
??$tagFlagCnt?? | ?The number of trailing filename characters to sample (".ssp" = -4)? | ?-4 |

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)

The default map on the iPhone is Maps, Apple's proprietary geolocation provider. Although the map is getting better, it doesn't work well outside the United States. It has nothing to offer compared to Google Maps. In this article, we discuss the feasible steps to use Google Maps to become the default map on your iPhone. How to Make Google Maps the Default Map in iPhone Setting Google Maps as the default map app on your phone is easier than you think. Follow the steps below – Prerequisite steps – You must have Gmail installed on your phone. Step 1 – Open the AppStore. Step 2 – Search for “Gmail”. Step 3 – Click next to Gmail app

WeChat is one of the social media platforms in China that continuously launches new versions to provide a better user experience. Upgrading WeChat to the latest version is very important to keep in touch with family and colleagues, to stay in touch with friends, and to keep abreast of the latest developments. 1. Understand the features and improvements of the latest version. It is very important to understand the features and improvements of the latest version before upgrading WeChat. For performance improvements and bug fixes, you can learn about the various new features brought by the new version by checking the update notes on the WeChat official website or app store. 2. Check the current WeChat version We need to check the WeChat version currently installed on the mobile phone before upgrading WeChat. Click to open the WeChat application "Me" and then select the menu "About" where you can see the current WeChat version number. 3. Open the app

When logging into iTunesStore using AppleID, this error saying "This AppleID has not been used in iTunesStore" may be thrown on the screen. There are no error messages to worry about, you can fix them by following these solution sets. Fix 1 – Change Shipping Address The main reason why this prompt appears in iTunes Store is that you don’t have the correct address in your AppleID profile. Step 1 – First, open iPhone Settings on your iPhone. Step 2 – AppleID should be on top of all other settings. So, open it. Step 3 – Once there, open the “Payment & Shipping” option. Step 4 – Verify your access using Face ID. step

The Apple Vision Pro headset is not natively compatible with computers, so you must configure it to connect to a Windows computer. Since its launch, Apple Vision Pro has been a hit, and with its cutting-edge features and extensive operability, it's easy to see why. Although you can make some adjustments to it to suit your PC, and its functionality depends heavily on AppleOS, so its functionality will be limited. How do I connect AppleVisionPro to my computer? 1. Verify system requirements You need the latest version of Windows 11 (Custom PCs and Surface devices are not supported) Support 64-bit 2GHZ or faster fast processor High-performance GPU, most

Screenshot feature not working on your iPhone? Taking a screenshot is very easy as you just need to hold down the Volume Up button and the Power button at the same time to grab your phone screen. However, there are other ways to capture frames on the device. Fix 1 – Using Assistive Touch Take a screenshot using the Assistive Touch feature. Step 1 – Go to your phone settings. Step 2 – Next, tap to open Accessibility settings. Step 3 – Open Touch settings. Step 4 – Next, open the Assistive Touch settings. Step 5 – Turn on Assistive Touch on your phone. Step 6 – Open “Customize Top Menu” to access it. Step 7 – Now you just need to link any of these functions to your screen capture. So click on the first

The country or region of your Apple ID cannot be changed. In many cases, you cannot change the region of your Apple ID. We have discussed all these conditions and their respective solutions so that you can change AppleID on iPhone. Fix 1 – Cancel all active subscriptions Apple does not allow you to perform region modification operations if you already have active subscriptions. Typically, these apps have different subscription plans, tiers, and fees (currencies) in different regions. Step 1 – You have to go to Settings. Step 2 – You will find your Apple ID at the top of the Settings page. Step 3 – Click once to open it. Step 4 – On the next page, open the Subscriptions menu. Step 5 – You can view it in

Having issues with the Shazam app on iPhone? Shazam helps you find songs by listening to them. However, if Shazam isn't working properly or doesn't recognize the song, you'll have to troubleshoot it manually. Repairing the Shazam app won't take long. So, without wasting any more time, follow the steps below to resolve issues with Shazam app. Fix 1 – Disable Bold Text Feature Bold text on iPhone may be the reason why Shazam is not working properly. Step 1 – You can only do this from your iPhone settings. So, open it. Step 2 – Next, open the “Display & Brightness” settings there. Step 3 – If you find that “Bold Text” is enabled

Is the clock app missing from your phone? The date and time will still appear on your iPhone's status bar. However, without the Clock app, you won’t be able to use world clock, stopwatch, alarm clock, and many other features. Therefore, fixing missing clock app should be at the top of your to-do list. These solutions can help you resolve this issue. Fix 1 – Place the Clock App If you mistakenly removed the Clock app from your home screen, you can put the Clock app back in its place. Step 1 – Unlock your iPhone and start swiping to the left until you reach the App Library page. Step 2 – Next, search for “clock” in the search box. Step 3 – When you see “Clock” below in the search results, press and hold it and
