26
- Smartyの設置方法
- Feb 26, 2008
本家サイトから、Smarty本体を落してきてください。
↓
解凍すると
Smarty-2.*.*
├demo/
├libs/
├misc/
├unit_test/
└その他ファイル
が現れますが、使うのは「libs」フォルダです。
↓
「libs」をサーバにあげます。
↓
次に「tpl」と「tmp」フォルダを作成します。「tmp」をパーミションを707にします。
↓
Smartyファイルの読み込み。
require_once("./libs/Smarty.class.php");
↓
クラスの呼び出し。
$mySmarty=new Smarty();
↓
各種ファイルの場所を指定
tplの読み込み先
$mySmarty->compile_dir = ("./tpl");
キャッシュの吐き出し先
$mySmarty->template_dir = ("./tmp");
変数を渡します。
$mySmarty->assign("test","Smarty設置テスト");
使用するtplを指定
$mySmarty->display("../tpl/home.tpl");
↓
完了





No Comments, Comment or Ping
Reply to “Smartyの設置方法”