Custom Joomla 1.5 Error pages

Discussion in 'PHP/MySql' started by balajia, Aug 3, 2010.

  1. balajia New Member

    Member Since:
    Jul 1, 2010
    Message Count:
    27
    Likes Received:
    1
    Occupation:
    Web Developer
    Location:
    India
    Joomla! 1.5 uses the error.php in templates/system to handle HTTP Status errors, including "403", "404", and "500" Errors. By tweaking the error.php file you can create your own error pages for these or other HTTP errors.

    Note that you cannot include modules or use <jdoc:include> statements in the error.php file.



    "Overriding the System Error Results:"
    To override the system error results, copy the templates/system/error.php file into your templates/<template-name> directory. When Joomla 1.5 finds a file there it will use the file in this template instead of the system error.php file. Using the new error.php file, style it such that it matches your template.



    "Overriding the System Styling:"

    If you want to change the styling, change the stylesheet:
    <link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/system/css/error.css" type="text/css" />

    to match the stylesheet of your template.



    "Customizing Error Messages:"

    To create custom error message for each HTTP error, you'll need to add the following code in the error.php document.

    An example of this follows for error 500 (Internal Server Error)

    <?php if ($this->error->code = '500') { ?>
    <div id="errorboxheader">Internal Server Error</div>
    <div id="errorboxbody">
    <p>The action you performed has resulted in an internal server error!</p>
    </div>
    </div>
    <?php } ?>

Share This Page