Difference between revisions of "JError/customErrorPage"
From Joomla! Documentation
< API15:JError
m (removing red link to edit, no existant pages) |
|||
Line 3: | Line 3: | ||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
− | <nowiki>[< | + | <nowiki>[<! removed edit link to red link >]</nowiki> |
</span> | </span> | ||
− | + | <! removed transcluded page call, red link never existed > | |
===Syntax=== | ===Syntax=== | ||
Line 72: | Line 72: | ||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
− | <nowiki>[< | + | <nowiki>[<! removed edit link to red link >]</nowiki> |
</span> | </span> | ||
− | + | <! removed transcluded page call, red link never existed > | |
===Examples=== | ===Examples=== | ||
Line 87: | Line 87: | ||
format= ,,, | format= ,,, | ||
</dpl> | </dpl> | ||
+ | [[Category:Archived pages API15]] |
Revision as of 11:48, 12 May 2013
The "API15" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.
Description[edit]
Display a custom error page and exit gracefully
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
Syntax[edit]
customErrorPage(&$error)
Parameter Name | Default Value | Description |
---|---|---|
&$error | $error Exception object |
Returns[edit]
void
Defined in[edit]
libraries/joomla/error/error.php
Importing[edit]
jimport( 'joomla.error.error' );
Source Body[edit]
function customErrorPage(& $error)
{
// Initialize variables
jimport('joomla.document.document');
$app = & JFactory::getApplication();
$document = & JDocument::getInstance('error');
$config = & JFactory::getConfig();
//Get the current language direction
$language = &JFactory::getLanguage();
if ($language->isRTL()){
$dir ="rtl";
}
else {
$dir ="ltr";
}
// Get the current template from the application
$template = $app->getTemplate();
// Push the error object into the document
$document->setError($error);
@ob_end_clean();
$document->setTitle(JText::_('Error').': '.$error->code);
$document->setLanguage($language->getTag());
$document->setDirection($dir);
$data = $document->render(false, array (
'template' => $template,
'directory' => JPATH_THEMES,
'debug' => $config->getValue('config.debug')
));
JResponse::setBody($data);
echo JResponse::toString();
$app->close(0);
}
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
Examples[edit]
<CodeExamplesForm />