■手順その一
Smarty をダウンロード後に解凍。
libs というファイルだけを /home/アカウント名/ につっこむ。
/home/ドメイン名/libs って事になる。
■手順その二
自分が使用しているのは、さくらインターネットなので下記の設定を行なった。
さくらコントロールパネルから、
PHP設定ファイルの編集 を選択する。
php.iniファイルパスのテキスト欄に以下をコピペして保存する。
include_path=”.:/home/ドメイン名/libs/”
■手順その三
smarty が設定されているかのチェックを行う。
/home/ドメイン名/www/ネームドメイン/ に
以下のディレクトリを追加する。
templates/test.tpl
(パーミッション755)
templates_c
(パーミッション777)
index.php
(パーミッション777)
下記のようになればOK!
/home/ドメイン名/www/ネームドメイン/templates/test.tpl
/home/ドメイン名/www/ネームドメイン/templates_c
/home/ドメイン名/www/ネームドメイン/index.php
■手順その四
作成したindex.phpに下記をコピペする。
require_once('/home/アカウント名/www/libs/Smarty.class.php');
$smarty = new Smarty;
$smarty->template_dir = '/templates/';
$smarty->display('test.tpl');
?>
■手順その五
作成した test.tpl に適当に文章を打ち込む
例)
表示てすと
以上で設定は完了です。
http://www.○○○○/index.php
で、『表示てすと』って出ればOKです。
No related posts.







