©
이 문서에서는 PHP 중국어 웹사이트 매뉴얼 풀어 주다
This is a continuation of the basic
installation, please read that first!
这是基本安装的继续,请先阅读那个文件!
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环境。
为了避免重复地配置路径,我们可以在一个文件里配置这些变量。
我们创建一个目录 "/php/includes/guestbook/" 建立一个文件"setup.php"
同样先设置好smarty路径。
Example 2-10. Editing /php/includes/guestbook/setup.php
|
Now lets alter the index.php file to use setup.php:
现在我们针对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.
现在你看到创建一个使用smarty的实例有多么的简单.从Smarty_GuestBook开始,重新构建我们的应用程序吧^_^