public function aikiBaseHref() { aikiBaseHref($this); return $this; }
$__page = $__form; $__page->contentSetData($Item); } if (isset($Item["meta_description"])) { $tag = '<meta name="description" content="' . $Item["meta_description"] . '">'; $meta = $__page->find("meta[name=description]", 0); if (is_object($meta)) { $meta->before($tag); $meta->remove(); } else { $__page->find("head")->append($tag); } } if (isset($Item["meta_keywords"])) { $tag = '<meta name="keywords" content="' . $Item["meta_keywords"] . '">'; $meta = $__page->find("meta[name=keywords]", 0); if (is_object($meta)) { $meta->before($tag); $meta->remove(); } else { $__page->find("head")->append($tag); } } aikiSaveCache($__page); aikiBaseHref($__page); } } } if (is_callable("aikiAfterEngine")) { $Item = aikiAfterEngine($__page, $Item); }
function aikiGetTpl($tpl = NULL, $path = FALSE) { $__page = ""; if ($tpl == NULL && isset($_SESSION["engine_tpl"])) { $tpl = $_SESSION["engine_tpl"]; } if (!isset($_GET["mode"])) { $_GET["mode"] = "show"; $_GET["form"] = "page"; $_GET["id"] = "home"; } else { if ($tpl == NULL) { $tpl = "{$_GET["form"]}_{$_GET["mode"]}.php"; } } if ($_GET["mode"] == "show" && $_GET["form"] == "login") { $tpl = "login.php"; } if ($path == FALSE) { $tpl = "/tpl/" . $tpl; $current = ""; $res = false; if ($res == false && is_file($_SESSION["prj_path"] . "/forms/{$_GET["form"]}_{$_GET["mode"]}.php")) { $current = $_SESSION["prj_path"] . "/forms/{$_GET["form"]}_{$_GET["mode"]}.php"; $res = true; } if ($res == false && is_file($_SESSION["app_path"] . "/forms/{$_GET["form"]}_{$_GET["mode"]}.php")) { $current = $_SESSION["app_path"] . "/forms/{$_GET["form"]}_{$_GET["mode"]}.php"; $res = true; } if ($res == false && is_file($_SESSION["root_path"] . "/forms/{$_GET["form"]}_{$_GET["mode"]}.php")) { $current = $_SESSION["root_path"] . "/forms/{$_GET["form"]}_{$_GET["mode"]}.php"; $res = true; } if ($res == false && is_file($_SESSION["engine_path"] . "/forms/{$_GET["form"]}_{$_GET["mode"]}.php")) { $current = $_SESSION["engine_path"] . "/forms/{$_GET["form"]}_{$_GET["mode"]}.php"; $res = true; } if ($res == false && is_file($_SESSION["engine_path"] . "/forms/common/common_{$_GET["mode"]}.php")) { $current = $_SESSION["engine_path"] . "/forms/{common/common_{$_GET["mode"]}.php"; $res = true; } if ($res == false && is_file($_SESSION["app_path"] . $tpl)) { $current = $_SESSION["app_path"] . $tpl; $res = true; } if ($res == false && is_file($_SESSION["root_path"] . $tpl)) { $current = $_SESSION["root_path"] . $tpl; $res = true; } if ($res == false && is_file($_SESSION["engine_path"] . $tpl)) { $current = $_SESSION["engine_path"] . $tpl; $res = true; } $current = str_replace($_SESSION["root_path"], "", $current); if (isset($_GET["form"]) && $_GET["form"] > "") { $_GET["form"] = $_GET["form"]; } if (isset($_GET["mode"]) && $_GET["mode"] > "") { $_GET["mode"] = $_GET["mode"]; } if (!isset($_SESSION["getTpl"])) { // нужно, чтобы небыло зацикливания $inc = array("{$_SESSION["root_path"]}/forms/{$_GET["form"]}.php", "{$_SESSION["root_path"]}/forms/{$_GET["form"]}/{$_GET["form"]}.php", "{$_SESSION["engine_path"]}/forms/{$_GET["form"]}.php", "{$_SESSION["engine_path"]}/forms/{$_GET["form"]}/{$_GET["form"]}.php"); $res = FALSE; foreach ($inc as $k => $file) { if (is_file("{$file}") && $res == FALSE) { include_once "{$file}"; $res = TRUE; } } include_once "{$_SESSION["engine_path"]}/forms/common/common.php"; $res = false; $_SESSION["getTpl"] = true; if ($res == false && is_callable($_GET["mode"])) { $__page = $_GET["mode"](); $res = true; } $call = "{$_GET["form"]}_{$_GET["mode"]}"; if ($res == false && is_callable($call)) { $__page = $call(); $res = true; } // в проектах $call = "common__{$_GET["mode"]}"; if ($res == false && is_callable($call)) { $__page = $call(); $res = true; } // в общем случае $call = "{$_GET["form"]}__{$_GET["mode"]}"; if ($res == false && is_callable($call)) { $__page = $call(); $res = true; } // в engine unset($_SESSION["getTpl"]); } if (!is_object($__page) && $current > "") { $__page = ki::fromFile("{$_SERVER["DOCUMENT_ROOT"]}{$current}"); } if (!is_object($__page) && $current == "") { $__page = ki::fromString(""); } } else { if (!is_file($tpl)) { $tpl = normalizePath("{$_SERVER["DOCUMENT_ROOT"]}/{$tpl}"); } $__page = ki::fromFile($tpl); } $file = explode("/", $tpl); $file = $file[count($file) - 1]; if ($path == FALSE) { $_SESSION["tplpath"] = strtr($tpl, array($_SERVER["DOCUMENT_ROOT"] => "", $file => "")); } aikiCheckCache($__page); if ($path == false) { aikiBaseHref($__page); } return $__page; }