您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

smarty加载出现有关问题

2024/3/18 19:05:57发布19次查看
smarty加载出现问题
init.inc.php
php codedefine ( '__root__', str_replace ( '\\', '/', dirname ( __file__ ) ) );include 'ext/smarty.class.php';class tpl extends smarty { function __construct() { $this->settemplatedir ( __root__./view ); $this->setcompiledir (__root__../comp_c ); $this->left_delimiter = right_delimiter = }>; parent::__construct(); }}
index.php
php codeinclude 'init.inc.php';class index extends tpl { function index(){ $this->assign('m','asdfasdfasdf'); $this->display('index.html'); }}$tpl = new index();$tpl->index();
用的smarty-3.1.11版本 报错信息是:
php codefatal error: call to a member function createtemplate() on a non-object in d:\appserv\www\smarty\ext\sysplugins\smarty_internal_templatebase.php on line 47
只是我用普通的方法就不会出现问题 比如:
php code$smarty = new smarty();$smarty->settemplatedir ( __root__ . /view );$smarty->setcompiledir ( __root__ . /comp_c );$smarty -> left_delimiter= right_delimiter=}>;include init.inc.php;$smarty->display(demo.tpl);
找了一天都没有解决,不知道哪里出现问题 求帮忙…
------解决方案--------------------
你 print_r($this->smarty); 看看
应该是没有实例化成功,即 $this->smarty 不是 smarty 对象
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product