smarty加载出现问题
init.inc.php
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> define ( '__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(); } }
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> include 'init.inc.php'; class Index extends Tpl { function index(){ $this->assign('m','asdfasdfasdf'); $this->display('index.html'); } } $tpl = new Index(); $tpl->index();
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> Fatal 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
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> $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");