菜鸟求帮助,继承smarty类后遇到的一个问题,调用模板报错....

index.php代码:<?phpheader("Content-Type:text/html;charset=utf-8");include_once'mysql_co... index.php 代码:
<?php
header("Content-Type: text/html; charset=utf-8");
include_once 'mysql_connection.php';
include_once 'smarty/smarty_setup.php';
............................
$array=array();
............................
$smarty=new Smarty_Setup();
$smarty->assign("array",$array);
$smarty->display('index.html');
?>

smarty_setup.php 代码:
<?php
include_once "C:/AppServ/Smarty/libs/Smarty.class.php";
class Smarty_Setup extends Smarty {
function _construct() {
parent::_construct();

$this->template_dir = 'C:/AppServ/www/testSmarty/smarty/templates/';

$this->config_dir = 'C:/AppServ/www/testSmarty/smarty/configs/';

$this->cache_dir = 'C:/AppServ/www/testSmarty/smarty/smarty_cache/';

$this->compile_dir = 'C:/AppServ/www/testSmarty/smarty/smarty_templates_c/';

$this->cache_lifetime = 0;

$this->caching = true;

$this->left_delimiter = "{#";

$this->right_delimiter = "#}";

$this->assign('app_name','Smarty_SetupTest');

}
}
?>
网站目录图如下:
报错如下:
Fatal error: Uncaught exception 'SmartyException' with message 'Unable to load template file 'index.html'' in C:\AppServ\Smarty\libs\sysplugins\smarty_internal_templatebase.php:127 Stack trace: #0 C:\AppServ\Smarty\libs\sysplugins\smarty_internal_templatebase.php(374): Smarty_Internal_TemplateBase->fetch('index.html', NULL, NULL, NULL, true) #1 C:\AppServ\www\testSmarty\index.php(69): Smarty_Internal_TemplateBase->display('index.html') #2 {main} thrown in C:\AppServ\Smarty\libs\sysplugins\smarty_internal_templatebase.php on line 127
展开
 我来答
马可财经
2012-10-14 · TA获得超过742个赞
知道小有建树答主
回答量:445
采纳率:0%
帮助的人:254万
展开全部
_construct改为__construct即可解决你的问题。

__construct为对象的构造函数,你的_construct并不是构造函数,所以你的Smarty_Setup对象在初始化的时候并没有载入你想要的配置,所以smarty报错了。
刘鹏云1123
2012-10-16 · TA获得超过168个赞
知道小有建树答主
回答量:290
采纳率:57%
帮助的人:61.3万
展开全部
你的模板出了问题,少了一个变量符号或者大括号!
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
99downs
2012-10-26
知道答主
回答量:14
采纳率:0%
帮助的人:11.9万
展开全部
你配置好没,下面是个地址,检查下吧

参考资料: http://wenku.baidu.com/view/c747d9737fd5360cba1adbec.html

已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式