日期:2014-05-17 浏览次数:20512 次
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 = "<{"; $this->right_delimiter = "}>"; parent::__construct(); } }
include 'init.inc.php'; class Index extends Tpl { function index(){ $this->assign('m','asdfasdfasdf'); $this->display('index.html'); } } $tpl = new Index(); $tpl->index();
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
$smarty = new Smarty(); $smarty->setTemplateDir ( __ROOT__ . "/View" ); $smarty->setCompileDir ( __ROOT__ . "/comp_c" ); $smarty -> left_delimiter="<{"; $smarty -> right_delimiter="}>"; include "init.inc.php"; $smarty->display("demo.tpl");