Improved template handling with exceptions

The Page class is now responsible for executing the subpage template
rather than the index file.
Template processing has been improved with exceptions to catch 404s, or
any other template exception, which will abort the current page and
display an error document instead.
This commit is contained in:
2010-03-21 00:21:04 +00:00
parent 42268af1c7
commit c17e3f0e04
4 changed files with 61 additions and 0 deletions

6
templates/errors/404.tpl Normal file
View File

@@ -0,0 +1,6 @@
<h2>The requested page could not be found</h2>
<p>
The file you requested ({$requested_page}) could not be found.
If you typed in the address manually, check that you have spelled it correctly,
or if you followed a link, let us know and we'll look into it.
</p>

View File

@@ -0,0 +1,36 @@
<h2>An unhandled error has occurred</h2>
<p>
There was a problem trying to complete the requested action. Please try again and if the problem persists, let us know.
</p>
{if $display_exceptions}
<p>
An unhandled exception was caught during the page template processing. The full details are shown below:
</p>
<table class="exception-details">
<colgroup id="header">
<col />
</colgroup>
<colgroup>
<col />
</colgroup>
<tbody>
<tr>
<th>Exception</th>
<td>{$exception_type}</td>
</tr>
<tr>
<th>File</th>
<td>{$exception->getFile()}</td>
</tr>
<tr>
<th>Line</th>
<td>{$exception->getLine()}</td>
</tr>
<tr>
<th>Message</th>
<td>{$exception->getMessage()}</td>
</tr>
</tbody>
</table>
{/if}