function _template($file, $dataArr = null, $sqlQuerySet = null) { //$file=str_replace(".","/",$file); if (strtolower(strstr($file, ".")) != ".tpl") { $file .= ".tpl"; } if (!file_exists($file)) { if (file_exists(APPROOT . TEMPLATE_FOLDER . $file)) { $file = APPROOT . TEMPLATE_FOLDER . $file; } elseif (file_exists(ROOT . TEMPLATE_FOLDER . $file)) { $file = ROOT . TEMPLATE_FOLDER . $file; } else { return false; } } $ext = explode(".", $file); $ext = $ext[count($ext) - 1]; $ext = ".{$ext}"; $engine = LogiksTemplate::getEngineForExtension($ext); $lt = new LogiksTemplate($engine); $lt->loadSQL($sqlQuerySet); if (MASTER_DEBUG_MODE) { $lt->printTemplate($file, $dataArr, true); } else { $lt->printTemplate($file, $dataArr); } }
function _templateFetch($file, $dataArr = null, $sqlQuerySet = null, $tmplID = null) { //$file=str_replace(".","/",$file); if (strtolower(strstr($file, ".")) != ".tpl") { $file .= ".tpl"; } if (!file_exists($file)) { $fss = []; if (defined("APPS_TEMPLATE_FOLDER")) { $fss[] = APPROOT . APPS_TEMPLATE_FOLDER . $file; } if (defined("TEMPLATE_FOLDER")) { $fss[] = APPROOT . TEMPLATE_FOLDER . $file; $fss[] = ROOT . TEMPLATE_FOLDER . $file; } $templateFound = false; foreach ($fss as $fx) { if (file_exists($fx)) { $file = $fx; $templateFound = true; break; } } if (!$templateFound) { return false; } } $ext = explode(".", $file); $ext = $ext[count($ext) - 1]; $ext = ".{$ext}"; $engine = LogiksTemplate::getEngineForExtension($ext); $lt = new LogiksTemplate($engine); $sqlFile = str_replace(".tpl", ".sql", $file); if (!file_exists($sqlFile)) { $sqlFile = false; } $lt->loadSQL($sqlFile); $lt->loadSQL($sqlQuerySet); if (MASTER_DEBUG_MODE) { return $lt->getTemplateData($file, $dataArr, $tmplID, true); } else { return $lt->getTemplateData($file, $dataArr, $tmplID); } }