本文整理匯總了PHP中TemplateEngine::processTemplate方法的典型用法代碼示例。如果您正苦於以下問題:PHP TemplateEngine::processTemplate方法的具體用法?PHP TemplateEngine::processTemplate怎麽用?PHP TemplateEngine::processTemplate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類TemplateEngine
的用法示例。
在下文中一共展示了TemplateEngine::processTemplate方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _templateData
function _templateData($templateData, $dataArr = null, $sqlData = "", $tmplID = null, $editable = true)
{
if ($dataArr == null) {
$dataArr = array();
$dataArr["date"] = date(getConfig("PHP_DATE_FORMAT"));
$dataArr["time"] = date(getConfig("TIME_FORMAT"));
$dataArr["datetime"] = date(getConfig("PHP_DATE_FORMAT") . " " . getConfig("TIME_FORMAT"));
$dataArr["site"] = SITENAME;
if (isset($_REQUEST["page"])) {
$dataArr["page"] = $_REQUEST["page"];
} else {
$dataArr["page"] = "home";
}
if (isset($_SESSION["SESS_USER_ID"])) {
$dataArr["user"] = $_SESSION["SESS_USER_ID"];
} else {
$dataArr["user"] = "Guest";
}
if (isset($_SESSION["SESS_PRIVILEGE_ID"])) {
$dataArr["privilege"] = $_SESSION["SESS_PRIVILEGE_ID"];
} else {
$dataArr["privilege"] = "Guest";
}
if (isset($_SESSION["SESS_USER_NAME"])) {
$dataArr["username"] = $_SESSION["SESS_USER_NAME"];
} else {
$dataArr["user_name"] = "Guest";
}
if (isset($_SESSION["SESS_PRIVILEGE_NAME"])) {
$dataArr["privilegename"] = $_SESSION["SESS_PRIVILEGE_NAME"];
} else {
$dataArr["privilege_name"] = "Guest";
}
} else {
if (!isset($dataArr["date"])) {
$dataArr["date"] = date(getConfig("PHP_DATE_FORMAT"));
}
if (!isset($dataArr["time"])) {
$dataArr["time"] = date(getConfig("TIME_FORMAT"));
}
if (!isset($dataArr["datetime"])) {
$dataArr["datetime"] = date(getConfig("PHP_DATE_FORMAT") . " " . getConfig("TIME_FORMAT"));
}
if (!isset($dataArr["site"])) {
$dataArr["site"] = SITENAME;
}
if (!isset($dataArr["page"])) {
if (isset($_REQUEST["page"])) {
$dataArr["page"] = $_REQUEST["page"];
} else {
$dataArr["page"] = "home";
}
}
if (!isset($dataArr["user"])) {
if (isset($_SESSION["SESS_USER_ID"])) {
$dataArr["user"] = $_SESSION["SESS_USER_ID"];
} else {
$dataArr["user"] = "Guest";
}
}
if (!isset($dataArr["privilege"])) {
if (isset($_SESSION["SESS_PRIVILEGE_ID"])) {
$dataArr["privilege"] = $_SESSION["SESS_PRIVILEGE_ID"];
} else {
$dataArr["privilege"] = "Guest";
}
}
if (!isset($dataArr["username"])) {
if (isset($_SESSION["SESS_USER_NAME"])) {
$dataArr["username"] = $_SESSION["SESS_USER_NAME"];
} else {
$dataArr["user_name"] = "Guest";
}
}
if (!isset($dataArr["privilegename"])) {
if (isset($_SESSION["SESS_PRIVILEGE_NAME"])) {
$dataArr["privilegename"] = $_SESSION["SESS_PRIVILEGE_NAME"];
} else {
$dataArr["privilege_name"] = "Guest";
}
}
}
$body = TemplateEngine::processTemplate($templateData, $dataArr, $editable);
return $body;
}