FTPでSmartyを設置することでご利用いただけます。
下記の手順を参考にお試しください。
- Smartyのインストール
-
Smartyを以下の配布元からダウンロードしてください。
参照サイト: Smarty > Downloads
- ご利用のPC上でダウンロードした圧縮ファイルを解凍すると、「Smarty-x.x.x」というフォルダができるので、フォルダ名を「Smarty」に変更します。
- 「Smarty」フォルダをFTPで public_html より上の階層(インターネットに公開されない場所)にアップロードします。
【ファイル構造】
/etc/
/public_html/
/Smarty/- Smartyが使用する以下のディレクトリを public_html 以下の任意の場所に作成します。
ディレクトリ名 パーミッション 説明 templates 755 または 705 テンプレートディレクトリ templates_c 707 コンパイルディレクトリ configs 755 または 705 設定ファイルディレクトリ cache 707 キャッシュディレクトリ 【ファイル構造】
/Smarty/
/public_html/sample/templates/
/templates_c/
/configs/
/cache/- 作成した templates ディレクトリに、テンプレートファイルをアップロードします。
ここでは、例として下記の記述をした index.tpl を、/public_html/sample/templates/index.tpl にアップロードします。{* Smarty *}
こんにちは、{$name}。ようこそ Smarty へ!【ファイル構造】
/Smarty/
/public_html/sample/templates/index.tpl
/templates_c/
/configs/
/cache/- 動作テスト用の index.php を作成し、/public_html/sample/index.php にアップロードします。
<?php
require("/home/アカウント名/Smarty/libs/Smarty.class.php");
$smarty = new Smarty();
$smarty->template_dir = "./templates";
$smarty->compile_dir = "./templates_c";
$smarty->cache_dir = "./cache";
$smarty->config_dir = "./configs";
$smarty->assign("name", "KAGOYA");
$smarty->display("index.tpl");
?>【ファイル構造】
/Smarty/
/public_html/sample/templates/index.tpl
/templates_c/
/configs/
/cache/
index.php- ブラウザで index.php にアクセスし、「こんにちは、KAGOYA。ようこそ Smarty へ!」と表示されることを確認します。
-
詳しくは、下記のページをご確認ください。
参照サイト: Smarty > 基本的なインストール