プロが教える店舗&オフィスのセキュリティ対策術

Smarty動的Webサイト構築入門という書籍を見ながらSmartyを学習しているのですが、書籍のCD-ROMから落としたサンプルファイルを保存しているのですがどうしてもテンプレートを読み込むことができません。

03_01.php
<?php
require_once("../smarty/libs/Smarty.class.php");
$smarty = new Smarty();
$smarty->template_dir = "templates";
$smarty->compile_dir = "templates_c";
$smarty->assign("name", "Smartyさん");
$smarty->display("03_01.tpl");
?>

03_01.tpl
Hello, {$name}!!

エラーメッセージ
Warning: Smarty error: unable to read resource: "03_01.tpl" in C:\xampp\htdocs\smartybook\smarty\libs\Smarty.class.php on line 1092

03_01.phpは、C:\xampp/htdocs/smartybook/ren/に保存しています。
03_01.tplは、C:\xampp/htdocs/smartybook/templates/に保存しています。

どこが駄目なのか教えてください。
宜しくお願いします。

A 回答 (1件)

エラーメッセージを見た限り、テンプレのページを読み込めないって事でしょうか。


読み込むディレクトリが間違ってませんか?
template_dir = "../templates";
のような気がします。違ったらゴメンナサイ。
    • good
    • 0
この回答へのお礼

ご回答ありがとうございます。

templatesとtemplates_cのファイルをrenファイル内に移動したら読み込むことができました。

ありがとうございました。

お礼日時:2008/10/09 02:25

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!