2011年2月17日木曜日

cakephpでsmarty smartyに値を渡す

ネイティブのphpではsmarty値を渡す時には以下のように書く。

$smarty->assign('name', $name);


cakephpではcontroller内に次の様に書くことでテンプレートで利用できる。


 $this->set('name',$name);

テンプレートではいずれも

 {$name}

で値を表示できる。

0 件のコメント:

コメントを投稿