Вход Регистрация
Файл: engine/templater.class.php
Строк: 33
<?php
class templater{
    private 
$path$template$file$dir;
    private 
$variables = array();
    
    function 
__construct(){
        
$this->dir 'templates/';
        
    }
    
/*
    * Подключим каталог шаблона
    */
    
public function pathtemplater($tmp$template_name ='default'){
        
//Полный путь к файлу шаблонов
        
$this->path $tmp.$this->dir.$template_name;
        
//Проверим шаблон на существование
        
if(!is_dir($this->path)){
            throw new 
Exception('path directory '.$this->path.' not found');
        }
    }
    
/*
    * Обработка переменых
    */
    
public function set_var($name$value){
        
$this->variables[$name] = $value;
    }
    
/*
    * Отображение шаблона
    */
    
public function show_display($file_includes){
        
$this->templater $file_includes;
        if(!
file_exists($this->path.'/'.$this->templater)){
            throw new 
Exception('include file '.$this->path.'/'.$this->templater.' not found');
        }
        
        require_once 
$this->path.'/'.$this->templater;
    }
    
/*
    * Вызов магического метода get при образении к несуществуещему свойству
    */
    
public function __get($name){
        if(isset(
$this->variables[$name])){
            
$variable $this->variables[$name];
            return 
$variable;
        }
        return 
NULL;
        
    }
    
}

?>
Онлайн: 1
Реклама