本文整理汇总了PHP中sfException::getTemplatePathForError方法的典型用法代码示例。如果您正苦于以下问题:PHP sfException::getTemplatePathForError方法的具体用法?PHP sfException::getTemplatePathForError怎么用?PHP sfException::getTemplatePathForError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfException
的用法示例。
在下文中一共展示了sfException::getTemplatePathForError方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<?php
include sfException::getTemplatePathForError('xml', false);
示例2: preRenderCheck
protected function preRenderCheck()
{
if (null === $this->template) {
throw new sfRenderException('A template has not been set.');
}
if (!is_readable($this->directory . '/' . $this->template)) {
if ('404' == $this->context->getResponse()->getStatusCode()) {
$this->template = sfException::getTemplatePathForError($this->context->getRequest()->getRequestFormat(), false);
$this->directory = dirname($this->template);
$this->template = basename($this->template);
$this->setAttribute('code', '404');
$this->setAttribute('text', 'Not Found');
} else {
throw new sfRenderException(sprintf('The template "%s" does not exist or is unreadable in "%s".', $this->template, $this->directory));
}
}
}
示例3: preRenderCheck
/**
* Executes a basic pre-render check to verify all required variables exist
* and that the template is readable.
*
* @throws sfRenderException If the pre-render check fails
*/
protected function preRenderCheck()
{
if (is_null($this->template)) {
// a template has not been set
throw new sfRenderException('A template has not been set.');
}
if (!is_readable($this->directory . '/' . $this->template)) {
// 404?
if ('404' == $this->context->getResponse()->getStatusCode()) {
// use default exception templates
$this->template = sfException::getTemplatePathForError($this->context->getRequest()->getRequestFormat(), false);
$this->directory = dirname($this->template);
$this->template = basename($this->template);
$this->setAttribute('code', '404');
$this->setAttribute('text', 'Not Found');
} else {
throw new sfRenderException(sprintf('The template "%s" does not exist or is unreadable in "%s".', $this->template, $this->directory));
}
}
// check to see if this is a decorator template
if ($this->decorator && !is_readable($this->decoratorDirectory . '/' . $this->decoratorTemplate)) {
throw new sfRenderException(sprintf('The decorator template "%s" does not exist or is unreadable in "%s".', $this->decoratorTemplate, $this->decoratorDirectory));
}
}