modX.sendError
Last updated May 14th, 2019 | Page history | Improve this page | Report an issue
Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
Backers
Budget
$194 per month—let's make that $500!
Learn moremodX::sendError¶
Send the user to a type-specific core error page and halt PHP execution. MODX ships two such pages: unavailable (the default) and fatal.
Syntax¶
void sendError ([string $type = ''], [array $options = array()])
-
$type(string) Name of the error template incore/error/{type}.include.php. When empty, the value is taken from theerror_typekey of$options, defaulting tounavailable. -
$options(array) Values used to build the error page:-
error_pagetitle— the<title>of the page (defaultError 503: Service temporarily unavailable) -
error_message— the body HTML (default<p>Site temporarily unavailable.</p>) -
error_header— the raw HTTP header line sent (defaultHTTP/1.1 503 Service Unavailable) -
error_type— fallback for an empty$type
-
The method clears output buffers, sends the header, prints the page, closes the session and calls exit() — nothing after it runs.
Examples¶
Send an Unavailable 503 error page.
$modx->sendError('unavailable');
Send a Fatal 500 error page.
$modx->sendError('fatal');
See Also¶
Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
Backers
Budget
$194 per month—let's make that $500!
Learn more










