refactoring new project structure

This commit is contained in:
xinatorus
2020-04-21 17:59:37 +02:00
parent c520cf847c
commit 85b10e1098
14 changed files with 57 additions and 91 deletions

View File

@@ -1,13 +1,13 @@
<?php
class Template extends Partial{
var $assignedValues = [];
var $partBuffer;
var $path;
var $debug;
class Template{
private $assignedValues = [];
private $partBuffer;
private $path;
private $debug;
function __construct($path = "", $debug = false) {
$this->debug = $debug;
if (!empty('app/templates/' . $path . '.phtml') && file_exists('app/templates/' . $path . '.phtml')) {
if (!empty('../app/templates/' . $path . '.phtml') && file_exists('../app/templates/' . $path . '.phtml')) {
$this->path = $path;
} else {
echo '<pre>';
@@ -26,9 +26,9 @@ class Template extends Partial{
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');
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');
require_once('../app/templates/' . $this->path . '.phtml');
}
}