求相助使用smarty模版时Warning: Smarty error: unable to read resource

WBOY
リリース: 2016-06-13 12:20:16
オリジナル
1276 人が閲覧しました

求帮助使用smarty模版时Warning: Smarty error: unable to read resource:

本帖最后由 tiancai784071179 于 2015-05-21 15:08:47 编辑 模板目录:我用$tpl->template_dir查了,模板目录也没错呀,为啥显示不出来了呢,哭求帮助
错误信息:Warning: Smarty error: unable to read resource: "admin" in D:\AppServ\www\moban\libs\Smarty.class.php on line 1095
以下是初始化的程序

define(ROOT, "C:/AppServ/www/xsphp/");
include ROOT."libs/Smarty.class.php";

$tpl=new Smarty;
$tpl->template_dir=ROOT."tpl/";
$tpl->compile_dir=ROOT."com";
$tpl->left_delimiter=" $tpl->right_delimiter="}>";
主程序: require "init.inc.php";

$title="this is a title";

$content="this is body content";

$tpl->assign("title", $title);
$tpl->assign("content", $content);

$tpl->display("default/test.tpl");


------解决思路----------------------
没看到你display admin的代码呢?代码贴全了没?
------解决思路----------------------
$tpl->display("default/test.tpl");


default/test.tpl文件呢,创建没有。
------解决思路----------------------
你指定你的tpl模板文件在/moban/tpl下了吗?
------解决思路----------------------
$tpl->display("admin"); 这个错的
------解决思路----------------------
然后
$tpl->display("admin.tpl");
関連ラベル:
ソース:php.cn
このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート
私たちについて 免責事項 Sitemap
PHP中国語ウェブサイト:福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!