1月 30
To install:

* Download the SmartyView class PHP file, here. (Then unzip it)
* Place the file in the 'app/views' or 'cake/libs/view' directory of your CakePHP installation.
* Download and install Smarty, and place it (preferably) in '/vendors/smarty' (lowercase) directory.
* That's it!

To use:

* Simply set the 'view' attribute of your controller class to 'Smarty'. (e.g. $this->view = 'Smarty';)
* Then place your templates in the same directory as CakePHP them to be, but use the (.tpl) extension.
* And that's it!

For template variables:

* Set the template variables like you use to in CakePHP (e.g. $this->set('var name in template', $var);)
* Then use the variables as a regular variables in Smarty (e.g. {$var_name_in_template})

其他:
* 还需要建立
/app/tmp/smarty/
/app/tmp/smarty/compile/
/app/tmp/smarty/cache
目录并设置为可写。

原文: http://projects.simpleteq.com/CakePHP/smarty.html
Defined tags for this entry:

作者 rollenc

| 主要出源 (0)
请对 365 天内更新的文章进行打分
当前分数: 2.60 of 5 。 5 次打分。 816 次点击

1 引用

  1. rollenc拼博

    cakephp与smarty的组合(二)组件形式
    通过component 的形式来使用smarty 前几天也记录了一下将smarty作为cakephp的视图解释器的方法:cakephp与smarty的组合,但是如何使用smarty的缓存却成了问题。因此,把smarty改为组件的形式可能更合适: To install: * Download and install Smarty, and place it (preferably) in '/vendors/smarty' (lowercase) directory. * 建立/app/cont 回复 ()

1 回复

回复显示方式(直线程 | 分线程)
  1. 学习笔记 says:

    这样的方法还是有问题的啊,郁闷死了~

    回复 ()

新增回复


You can use [geshi lang=lang_name [,ln={y|n}]][/lang] tags to embed source code snippets
电子邮件地址将不会被显示,而仅将被用于发送电子邮件通知

为了阻止机器人提交垃圾回复,请在相应的文本框中输入你在下面的图片中所看到的字符串。只有在你输入的字符串和图片中的字符串吻合的情况下,你的回复才能被成功提交。请确认你的浏览器支持、并且已经开启了cookies功能,否则的话,你的回复无法被正确地验证。
CAPTCHA