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
* 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: PHP

2007年02月10日 14时04分12秒
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 回复 ()