Редакция 368 |
Редакция 371 |
К новейшей редакции |
Авторство |
Сравнить с предыдущей |
Последнее изменение |
Открыть журнал
| Скачать
| RSS
<?php
/**
*
* Codename: ant-ng - generator of sources.list for Debian and
* distributives, based on Debian
* http://alex-w.org.ru/p/antng/
*
* Copyright (c) 2009 Alexander Wolf
* Dual licensed under the MIT and GNU LGPL licenses.
* http://alex-w.org.ru/p/antng/license
*
*/
/**
* Description of Template
*
* @author alexw
*/
//TODO Вместо Smarty лучше написать свой очень простой шаблонизатор - монстра использовать не целесообразно
class Template
{
private $path = NULL;
public function __construct
($folder) {
$this->path = $folder;
}
public function display
($name, $attrs = null) {
$content = implode('',$this->path.$name);
foreach ($attrs as $attr) {
$content = str_replace("{".$attr."}", $this->__get
($attr), $content);
}
return $content;
}
public function assign
($attr, $value) {
return $this->self[$attr] = $value;
}
public function __get
($attr = null) {
return $this->self[$attr];
}
}
?>