{exit}
Ends the request at once, with an empty body - the PAD way to stop instead of PHP's exit.
Syntax
{exit}
Description
{exit} calls padExit() and never comes back. The output buffers are emptied first, so nothing that was rendered before the tag ships either: the answer is status 200 with an empty body. The exit sequence still runs - the session is closed, the web headers are sent, the info and trace scopes that were open are ended - which is why a PAD application stops this way and never with PHP's exit or die.
From PHP the same is padExit (), and padExit ( 404 ) with a status code. To answer with an error status and the application's error page, use padAbort ( 404 ); to send the visitor elsewhere, {redirect}; to stop with a report, {error} or {dump}.
Examples
Nothing ships
The answer is an empty 200 - before is emptied out of the buffer, after is never processed.
before
{exit}
after
Stop for a probe
A request that only checks the page exists - a HEAD-like probe - gets an empty answer.
{if $probe}
{exit}
{/if}
<h2>The full page</h2>
See also
- {error} Raises a PAD error from the template, handled as the configured error action says.
- {dump} Stops the request and shows the debug dump of the engine's state at that point.
- {redirect} Sends the browser to another page or address with a 302 and ends the request.
- {restart} Abandons the page being built and renders another page in its place, in the same request.