菜鸟求帮助,继承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 展开
<?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 展开
3个回答
展开全部
你的模板出了问题,少了一个变量符号或者大括号!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你配置好没,下面是个地址,检查下吧
参考资料: http://wenku.baidu.com/view/c747d9737fd5360cba1adbec.html
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询