求相助使用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 학습자의 빠른 성장을 도와주세요!