Вход Регистрация
Файл: system/classes/Template.php
Строк: 19
<?php

class Template

{
    private 
$arr = [];
    private 
$class;
    private 
$header;
    private 
$footer;
    private 
$tpl;
    
    function 
__set ($name$value)
    {
        
$this->arr[$name] = $value;
    }
    
    function 
__get ($name)
    {
        return 
$this->arr[$name];
    }

    function 
run ($tpl 'main')
    {
        global 
$config;

        
$this->class = !ROUTER 'index' ROUTER;

        
$this->header 'theme/tpl/header.tpl';
        
$this->footer 'theme/tpl/footer.tpl';

        
$this->tpl 'app/' $this->class '/tpl/' $tpl '.tpl';

        if (
file_exists($this->header))
        {
            require_once (
$this->header);
        } 
        else 
        {
            exit (
'Шаблон <b>header.tpl</b> отсутствует.');
        }

        if (
file_exists($this->tpl)) 
        {
            require_once (
$this->tpl);
        }
        else
        {
            exit (
'Шаблон <b>'.$this->tpl.'</b> отсутствует.');
        }

        if (
file_exists($this->footer))
        {
            require_once (
$this->footer);
        }
        else
        {
            exit (
'Шаблон <b>footer.tpl</b> отсутствует.');
        }
    }
}
Онлайн: 1
Реклама