How to extend the Smarty class right

Posted by Evolutio on Stack Overflow See other posts from Stack Overflow or by Evolutio
Published on 2013-06-25T16:11:48Z Indexed on 2013/06/25 16:21 UTC
Read the original article Hit count: 436

Filed under:
|
|

I have a Problem with Smarty.

I have made this class:

<?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');
    }
}
?>

But why it doesn't works?

Here is the Error:

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

© Stack Overflow or respective owner

Related posts about php

Related posts about smarty