Размер файла: 1.28Kb
- <?php
- /**********************************
- * @package: PerfCMS *
- * @year: 2012 *
- * @author: Artas *
- * @link: http://perfcms.pp.ua *
- **********************************/
- class Template {
- public $type;
- public $format = '.html';
- public $tpln = 'default';
- public $html;
- public $values = array();
-
-
- public function __construct() {
- // $this->type = browser_type();
- $this->type = 'wap';
- }
-
- public function parse($tpl_name)
- {
- global $stylen;
- if(empty($tpl_name) || !file_exists(TPL.'/themes/'.$this->type.'/'. $stylen .'/'.$tpl_name . $this->format))
- {
- return false;
- }
- else
- {
- $this->html = file_get_contents(TPL.'/themes/'.$this->type.'/'. $stylen .'/'.$tpl_name . $this->format);
- }
- }
-
- public function set_value($key, $var)
- {
- $key = '{'.$key.'}';
- $this->values[$key] = $var;
- }
-
-
- public function view()
- {
- foreach($this->values as $find => $replace)
- {
- $this->html = str_replace($find, $replace, $this->html);
- }
- echo $this->html;
- }
-
- public function div($div, $content)
- {
- echo "<div class=\"{$div}\">{$content}</div>\n";
- }
- }