?
このドキュメントでは、 php中國語ネットマニュアル リリース
This is a continuation of the basic
installation, please read that first!
這是基本安裝的繼續(xù),請先閱讀那個文件!
A slightly more flexible way to setup Smarty is to extend the class and initialize your Smarty environment. So instead of repeatedly setting directory paths, assigning the same vars, etc., we can do that in one place. Lets create a new directory "/php/includes/guestbook/" and make a new file called "setup.php". In our example environment, "/php/includes" is in our include_path. Be sure you set this up too, or use absolute file paths.
一個更靈活一點的配置Smarty的方法是擴展類,和初始化你的smarty環(huán)境。
為了避免重復(fù)地配置路徑,我們可以在一個文件里配置這些變量。
我們創(chuàng)建一個目錄 "/php/includes/guestbook/" 建立一個文件"setup.php"
同樣先設(shè)置好smarty路徑。
Example 2-10. Editing /php/includes/guestbook/setup.php
|
Now lets alter the index.php file to use setup.php:
現(xiàn)在我們針對setup文件更改一下index文件
Example 2-11. Editing /web/www.mydomain.com/docs/guestbook/index.php
|
Now you see it is quite simple to bring up an instance of Smarty, just use
Smarty_GuestBook which automatically initializes everything for our application.
現(xiàn)在你看到創(chuàng)建一個使用smarty的實例有多么的簡單.從Smarty_GuestBook開始,重新構(gòu)建我們的應(yīng)用程序吧^_^