Smartyを利用した汎用のViewクラス
Smartyを利用した汎用のViewクラス。
これをさらに、Viewを呼び出すときにテンプレートディレクトリのパスを指定すると、さらにいいかもしれない。
<?php require_once('smarty/Smarty.class.php'); class View { function View() { $path = '../'; $this->smarty = new Smarty; $this->smarty->template_dir = $path . 'templates'; $this->smarty->compile_dir = $path . 'templates_c'; } function display($templateFile) { $this->smarty->display($templateFile); } function assign($params) { $this->smarty->assign($params); } } ?>