How to extend the Smarty class right
- by Evolutio
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