如何扩展Smarty类权利

时间:2013-06-25 16:11:49

标签: php smarty template-engine

我有Smarty的问题。

我上过这堂课:

<?php
require_once(INCLUDE_PATH.'smarty/Smarty.class.php');

class IndexPage extends Smarty {
    public $templateName = 'index.tpl';

    public function __construct() {
        parent::__construct();

        $this->showTemplate();
    }

    public function showTemplate() {
        self::display('index.tpl');
    }
}
?>

但为什么它不起作用?

这是错误:

Fatal error: Uncaught exception 'SmartyException' with message 'Unable to load
template file 'index.tpl'' in D:\xampp\htdocs\aiondb\lib\smarty\sysplugins\smarty_internal_templatebase.php:127
Stack trace:
#0 D:\xampp\htdocs\aiondb\lib\smarty\sysplugins\smarty_internal_templatebase.php(374): Smarty_Internal_TemplateBase->fetch('index.tpl', NULL, NULL, NULL, true)
#1 D:\xampp\htdocs\aiondb\lib\classes\IndexPage.class.php(14): Smarty_Internal_TemplateBase->display('index.tpl')
#2 D:\xampp\htdocs\aiondb\lib\classes\IndexPage.class.php(10): IndexPage->showTemplate() 
#3 D:\xampp\htdocs\aiondb\index.php(3): IndexPage->__construct()
#4 {main} thrown in D:\xampp\htdocs\aiondb\lib\smarty\sysplugins\smarty_internal_templatebase.php on line 127

0 个答案:

没有答案