Smartyのサブクラスを作る
Smarty本体をそのまま使うと、面倒なことが出てくるので、スマートにするためにサブクラスを作る。
require_once ("Smarty/Smarty.php");
class Sub_Smarty extends Smarty {
//**
//* コンストラクタ
//*
function Sub_Smarty() {
//●スーパークラス
$this->Smarty();
//●各種設定
$this->template_dir = "template_path";
$this->compile_dir = "compile_path";
}
}
簡単にはこんな感じ。
template_path と compile_pathはそれぞれのディレクトリを指定する。
相対パスでもよいが、Smartyを使うくらいの規模であるなら、絶対パスがおすすめ。
★例:"/home/usrroot/template/", "C:\InetPub\usrroot\"