本文整理匯總了PHP中Typeframe::FindTemplate方法的典型用法代碼示例。如果您正苦於以下問題:PHP Typeframe::FindTemplate方法的具體用法?PHP Typeframe::FindTemplate怎麽用?PHP Typeframe::FindTemplate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Typeframe
的用法示例。
在下文中一共展示了Typeframe::FindTemplate方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: execute
public function execute()
{
static $executed = false;
if (!$executed) {
$executed = true;
$this->_executeApplicationCode();
Typeframe::Timestamp('Controller and triggers executed');
$selectedTemplate = $this->_template;
if (!$selectedTemplate && $this->_application->name()) {
$pathinfo = pathinfo($this->_controller);
$selectedTemplate = substr($pathinfo['dirname'], strlen(TYPEF_SOURCE_DIR . '/controllers')) . '/' . $pathinfo['filename'] . '.html';
$finalTemplate = Typeframe::FindTemplate($selectedTemplate);
if (is_null($finalTemplate)) {
$selectedTemplate = null;
}
} else {
$finalTemplate = Typeframe::FindTemplate($selectedTemplate);
}
// $selectedTemplate tells us if a template was selected (either explicitly or automatically).
// $finalTemplate tells us if the template is valid.
if ($selectedTemplate) {
if ($finalTemplate) {
Typeframe::Timestamp('Starting page render');
if ($this->_redirectLocation) {
// If there were errors sent to the browser (i.e., output has already started), don't use meta redirect
//if ( (headers_sent()) || (ob_get_length()) ) {
// Typeframe::Pagemill()->setVariable("time", 0);
//}
if (Typeframe::Pagemill()->getVariable('time') == 0 && $_SERVER['REQUEST_METHOD'] == 'POST' && !headers_sent() && !requestIsAjax()) {
$_SESSION['typef_redirect_message'] = Typeframe::Pagemill()->getVariable('message');
}
}
$this->_executedTemplate = $finalTemplate;
if ($this->_redirectHeader) {
if (!headers_sent() && !requestIsAjax()) {
header('Location: ' . $this->_redirectLocation, true, $this->_redirectResponseCode);
}
}
Typeframe::Pagemill()->writeFile($finalTemplate);
// TODO: Another quick and dirty hack to make JavaScript templates work.
/*$pathinfo = pathinfo($selectedTemplate);
switch ($pathinfo['extension']) {
case 'js':
$output = str_replace('<', '<', $output);
$output = str_replace('>', '>', $output);
$output = str_replace('&', '&', $output);
}
echo $output;*/
} else {
trigger_error("Template {$selectedTemplate} not found");
}
}
} else {
trigger_error("Page controller was already executed");
}
if (!$this->_redirectLocation && !requestIsAjax()) {
unset($_SESSION['typef_redirect_message']);
}
session_write_close();
}