~XeOn~, Вместо self юзай переменную в которой хранится инстанция объекта.
И вообще не понятно зачем ты наследуешь темплейт от регистри если практически не используешь его?
На мой взгляд более логичнее было выполнить примерно так (Всего лишь пример, не стал доводить до конца, но суть думаю ясна):
<?php
class Registry {
protected $_instance = NULL;
protected $_storage = array();
private function __construct() {
$this->Functions = new Functions;
$this->Core = new Core;
$this->Tpl = new Template;
//$this->Db = new DB(parse_ini_file(INCDIR . 'dbcofig.fdb'));
}
public static function instance () {
if(is_null(self::$instance))
$this->_instance = new __CLASS__;
return $this->_instance;
}
public function __set($name, $value) {
if(!isset($this->_storage[$name])) {
$this->_storage[$name] = $value;
return TRUE;
}
return FALSE;
}
public function __get($name) {
if(isset($this->_storage[$name]))
return $this->_storage[$name];
return NULL;
}
public function __isset($name) {
return isset($this->_storage[$name]);
}
public function __unset($name) {
if (isset($this->_storage[$name]) {
unset($this->_storage[$name]);
return TRUE;
}
return FALSE;
}
}
class Template extends Registry {
protected $_tplExt = '.php';
protected $_templates = array();
public static function setTemplate ($tpl) {
try {
$tpl = ROOT . 'modules' . DSEP . MODULE . DSEP . 'templates' . DSEP . $tpl . $this->_tplExt;
if (is_file($tpl)) {
$this->_templates[] = $tpl;
} else {
throw new Exception('Unable to set template "' . $tpl . '" - file is not exists');
}
} catch (Exception $e) {
echo $e->getMessage();
}
}
public static function render ($exit = false) {
//extract(parent::$_storage, EXTR_PREFIX_ALL, '');
foreach ($this->_templates as $tpl) {
if(file_exists($tpl)) {
echo "\n\t\t<!-- " . basename($tpl) . " begin -->\n";
require $tpl;
echo "\n\t\t<!-- " . basename($tpl) . " end -->\n";
}
}
if($exit) {
if(file_exists(ROOT . 'style' . DSEP . THEME . DSEP . 'templates' . DSEP . 'footer.php'))
require ROOT . 'style' . DSEP . THEME . DSEP . 'templates' . DSEP . 'footer.php';
exit;
}
}
}
$tpl = Template::instance();
$tpl->title = 'title';
$tpl->content = $content;
$tpl->setTemplate('content');
$tpl->render();