Made different Layouts more customizable
This commit is contained in:
@@ -56,6 +56,11 @@ class mfLayout {
|
||||
public function render() {
|
||||
$this->defaultLayoutvariables();
|
||||
|
||||
$tpl_path = VIEWDIR . "/" . $this->package . "/" . $this->template . ".php";
|
||||
if(!is_file($tpl_path)) {
|
||||
$tpl_path = VIEWDIR . "/default/" . $this->template . ".php";
|
||||
}
|
||||
|
||||
foreach ($this->tvars as $name => $value) {
|
||||
if ($name === "this")
|
||||
continue;
|
||||
@@ -64,7 +69,7 @@ class mfLayout {
|
||||
|
||||
ob_end_clean();
|
||||
ob_start();
|
||||
include(VIEWDIR . "/" . $this->package . "/" . $this->template . ".php");
|
||||
include($tpl_path);
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
@@ -162,7 +167,7 @@ class mfLayout {
|
||||
/*
|
||||
* Begin inline functions
|
||||
*/
|
||||
|
||||
|
||||
public static function strtrim($string, $chars) {
|
||||
if (strlen($string) <= $chars)
|
||||
return $string;
|
||||
@@ -236,6 +241,23 @@ class mfLayout {
|
||||
|
||||
}
|
||||
|
||||
|
||||
function mfLayoutInclude($filename, $folder = "") {
|
||||
global $mfLayoutPackage;
|
||||
|
||||
if($folder) {
|
||||
$folder = $fodler."/";
|
||||
}
|
||||
|
||||
$inc_path = VIEWDIR . "/" . LAYOUT_DEFAULTPACKAGE . "/" . $folder . $filename;
|
||||
if(!file_exists($inc_path)) {
|
||||
$inc_path = VIEWDIR . "/default/" . $folder . $filename;
|
||||
}
|
||||
|
||||
include $inc_path;
|
||||
}
|
||||
|
||||
|
||||
function __($string) {
|
||||
$lang = [];
|
||||
include(BASEDIR . "/lang/de.php");
|
||||
@@ -244,3 +266,4 @@ function __($string) {
|
||||
}
|
||||
return $string;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user