玄箱:Smartyの動作確認
Smartyの設定ができたので動作確認をする
まずはテンプレートファイル(HTML部分)の準備
作成場所はPHPディレクトリ内のtemplatesディレクトリ
vi test.tpl
内容
<html>
<head>
<meta http-equiv=Content-Type content="text/html; charset=euc-jp">
<title>{$title}</title>
</head>
テスト者の名前は{$name}です
</body>
</html>
次にPHPディレクトリ直下にtest.phpを作成する
vi test.php
内容
<?php
require("smarty.conf");
$name = "hogehoge";
$title = "Smarty Test";
$smarty -> assign('title', $title);
$smarty -> assign('name', $name);
$smarty -> display("test.tpl");
?>
あとはブラウザでアクセスして
テスト者の名前はhogehogeです
(´・ω・`){と表示されればOK)
あと残す設定はMYSQLだ
関連記事