本文整理汇总了PHP中TemplateManager::getTemplateForRequest方法的典型用法代码示例。如果您正苦于以下问题:PHP TemplateManager::getTemplateForRequest方法的具体用法?PHP TemplateManager::getTemplateForRequest怎么用?PHP TemplateManager::getTemplateForRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TemplateManager
的用法示例。
在下文中一共展示了TemplateManager::getTemplateForRequest方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getResponse
public static function getResponse($request)
{
require_once 'web/header.inc';
require_once 'web/page.inc';
require_once 'web/footer.inc';
require_once 'template/TemplateManager.php';
//inizio il conteggio delle query
require_once 'session.php';
Session::initializeQueryCounter();
self::$user = Session::getUser();
$data = self::elaborateRequest($request);
if (self::$requestedObject == "Login") {
self::redirect("");
} else {
if (self::$requestedObject == "Logout") {
Session::destroy();
self::redirect("");
}
}
$default = TemplateManager::getDefaultTemplate();
$parser = null;
$tentativi = 0;
while (is_numeric($parser) || is_null($parser)) {
$template = TemplateManager::getTemplateForRequest(self::$requestedObject, self::$currentID, self::$requestedAction);
if (is_numeric($parser) || is_null($template) || $template === false) {
$template = $default;
}
if ($tentativi == 1) {
echo "<h3>ERRORE IN " . $template . "</h3>";
}
if ($tentativi == 2) {
echo "<h3>ERRORE NEL TEMPLATE DI DEFAULT</h3>";
return;
}
$tentativi++;
$parser = TemplateParser::parseTemplate($template);
//echo "<p>" . serialize(is_numeric($parser)) . "</p>"; //DEBUG
}
//echo "parser creato: " . serialize($parser) . "<br />"; //DEBUG
$css = array();
$js = array();
$title = self::titleForRequest($request);
$cols_stack = array();
$write_h = false;
$write_f = false;
$ad = false;
// $i=0; //DEBUG
while ($el = $parser->nextElement()) {
// if($i==10) //DEBUG
// return; //DEBUG
// $i++; //DEBUG
$id = null;
$class = null;
switch ($el["tag"]) {
case "TEMPLATE":
break;
case "HEAD":
if ($el["type"] != "close") {
continue;
}
writeHeader($title, $css, $js);
break;
case "STYLESHEET":
if (isset($el["attributes"]["CSS"])) {
$c = $el["attributes"]["CSS"];
if ($c != "default/default") {
$css[] = $c;
}
}
break;
case "JS":
if (isset($el["attributes"]["SRC"])) {
$js[] = $el["attributes"]["SRC"];
}
break;
case "HEADER":
$write_h = true;
if ($el["type"] == "close") {
writePageHeader(self::$user, $ad);
$write_h = false;
}
break;
case "FOOTER":
$write_f = true;
if ($el["type"] == "close" || $el["type"] == "complete") {
writePageFooter(null, $ad);
$write_f = false;
}
break;
case "AD":
if ($write_h || $write_f) {
$ad = true;
} else {
$style = "default";
if (isset($el["attributes"]["STYLE"])) {
$style = $el["attributes"]["STYLE"];
}
writeAD($style);
}
break;
//.........这里部分代码省略.........