JonMifsud
Web Developer & Consultant

Custom Symphony CMS Error Pages

12 November 2013

As of Symphony 2.3, the CMS started to support custom Error Pages. However this is not widespread knowledge and most of us still had the standard error pages which dumped out the actual error on screen, not nice for the clients and could potentially expose the system, by showing where the error is coming up from the error stack.

At the time of writing there are 4 types of errors that you would need to cater for:

  • Database Error usererror.database.php

  • XSLT Error usererror.xslt.php

  • Missing Extension Error usererror.missing_extension.php

  • Generic Error usererror.generic.php

You could easily serve the same page for each of the above or customize them as you deem fit. In neither of these you are 100% sure weather the error is just on a single page or on the whole website so I'd always suggest catering for the worst scenario; that your website is inaccessible. In such case see what are the essentials you need to give; such as Contact Number and possibly email address, along with and links to separated client logins if you are providing other services.

The below steps will help you set up your very own error page(s) whilst still allowing you to see errors yourself.

  1. Create a new folder named template inside your workspace folder.

  2. Create a php file for each of the server errors you want to cater for above.

  3. In order to access the original error stream structure your php files as indicated below.

    <?php 
        if (isset($_GET['debug'])) {
            include (TEMPLATE . '/' . $errorfilename);
        } else {
            include (WORKSPACE . '/template/clienterror.tpl');
        }
    ?>
    
  4. Replace the $errorfilename with the name of the current php file, to show the correct error message when you use the ?debug parameter and replace the other include file with the actual error page you would like to display. I'd suggest to keep this html only.

  5. Test the results by either switching off your database or creating one of the above errors.

Following this you can rest assured you're giving the best possible user experience even when your website or webpage for one reason or another is unavailable.

Written by Jonathan Mifsud

Jonathan Mifsud is a web developer by day and an SEO enthusiast by night. He provides freelance web development and consultancy services and is available for hire. You can get in touch with him on twitter and Google+

Comments

Leave a Comment

There are no comments made so far.

Post a new Comment

Please write your name.
Please enter your comment
Please enter your email address.