mirror of
https://git.steelants.cz/SH/PHP_SMART_HOME_V3.git
synced 2026-10-11 17:54:34 +00:00
Template -> lib
This commit is contained in:
1 parent
8c96a6021a
commit
c520cf847c
1 file changed
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
class Template extends Partial{
|
||||
var $assignedValues = [];
|
||||
var $partBuffer;
|
||||
var $path;
|
||||
var $debug;
|
||||
|
||||
function __construct($path = "", $debug = false) {
|
||||
$this->debug = $debug;
|
||||
if (!empty('app/templates/' . $path . '.phtml') && file_exists('app/templates/' . $path . '.phtml')) {
|
||||
$this->path = $path;
|
||||
} else {
|
||||
echo '<pre>';
|
||||
echo 'PHTML: Template File ' . $path . ' not found';
|
||||
echo '</pre>';
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
function prepare($searchS, $repleaceS) {
|
||||
if (!empty($searchS)) {
|
||||
$this->assignedValues[strtoupper($searchS)] = $repleaceS;
|
||||
}
|
||||
echo ($this->debug == true ? var_dump($this->assignedValues) : '');
|
||||
}
|
||||
|
||||
function render() {
|
||||
extract($this->assignedValues);
|
||||
if (!empty('app/controls/' . $this->path . '.php') && file_exists('app/controls/' . $this->path . '.php')) {
|
||||
include('app/controls/' . $this->path . '.php');
|
||||
}
|
||||
require_once('app/templates/' . $this->path . '.phtml');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user