かめのはこ

とあるエンジニアのメモ帳です

cakephpでsmartyを利用する

モジュールをダウンロード
※SmartyView
 https://github.com/kaz29/smartyview
Smarty本体
 http://www.smarty.net/

以下を配置
core/vender/smarty # 本体のlibをsmartyって名前で設置
app/views/smarty.php # smartyviewのphpのみ設置

const.php

Configure::write('Smarty.subDir', '');
Configure::write('Smarty.layoutPath', '');

 
これやっとくとctpと同じパスでtplが利用できる
views/[controller]/[method].ctp
views/[controller]/smarty/[method].tpl → views/[controller]/[method].tpl

あとはコントローラに

public $view = 'Smarty';

を設定する(app_controolerに設定しておくと楽)