XAMPPへのSmartyのインストール
かなりあっさり出来たけど、一応メモを残しておきますか。
1. Smartyのサイトからファイルをダウンロード。
2. 自分のホームディレクトリで展開
$ tar xvzf Smarty-2.6.18.tar.gz
3. xamppのlibディレクトリの中に置く
$ mv Smarty-2.6.18 Smarty
$ mv Smarty/ /Applications/xampp/xamppfiles/lib/php
4. これでほぼ終了。テストコードを動かしてみる。まずTestSmarty.phpという名前のphp作る。
<?php
require_once("Smarty/libs/Smarty.class.php");
class TestSmarty extends Smarty {
function TestSmarty () {
$this->Smarty();
$mydir = dirname(__FILE__);
$this->template_dir = "$mydir/templates/";
$this->compile_dir = "$mydir/templates_c/";
$this->config_dir = "$mydir/configs/";
$this->cache_dir = "$mydir/cache/";$this->caching = 0;
}
}?>
あとは、templateディレクトリに適当なテンプレートファイルを置いて、こんな感じのphpを書けば動いてるのが、確認できる。
<?php
require_once('TestSmarty.php');$objSmarty = new TestSmarty();
$objSmarty->display('test.html');
?>
« XAMPPでユーザ毎のウェブディレクトリを有効にする | トップページ | MACのEclipseのテキストファイルエンコーディング »
「XAMPP」カテゴリの記事
- XAMPP + PDT + XdebugでのXdebugの設定(Mac OS X)(2010.02.27)
- XAMPPにpearのXML_RPCインストール(2007.11.06)
- XAMPPへのSmartyのインストール(2007.06.07)
- XAMPPでユーザ毎のウェブディレクトリを有効にする(2007.06.07)
この記事へのコメントは終了しました。
« XAMPPでユーザ毎のウェブディレクトリを有効にする | トップページ | MACのEclipseのテキストファイルエンコーディング »
コメント