Jump to content

Theme Tip: Create custom error pages with the Pages app

When IPS4 encounters an error (be it a simple 404 Not Found or a more complex configuration issue), the user sees a standard built-in error page. That's fine in many cases, but did you know you can create your own error page using our Pages app?

This is a particularly good approach for communities that use Pages for their website too. If you have built a website theme, the standard error page may not fit with your visual style, so building your own error page allows you to improve it. You might want to show some helpful links to other parts of your website, for example.


Creating your error page

The first step is creating your error page in Pages. Note that for this page, you must create a manual page - the Page Builder tool can't be used in this case.

In order to show the error on your page, there's two special tags you should insert in the page content. When your page is shown in response to an error, Pages will swap out these tags for the relevant text. They are:

  • {error_code}
    Replaced with the technical error code for this error. This code identifies the exact piece of code that triggered the error, and can be given to IPS support technicians to help diagnose problems.
  • {error_message}
    Replaced with a human-friendly description of the error that occurred.


Configuring Pages to use the error page

Next, set Pages to display the error page. You do this in the Pages section; click the Advanced Settings button, and select your page from the list. Note that this will replace all error pages across the suite - not just errors triggered by Pages itself!


Have a request for a theme tip? Let us know in the comments and we'll try and help out in a future tip! 




Recommended Comments

16 hours ago, Lyonharted said:

Can we also create a custom banned page? So that we can link people to a ban appeal if they're banned from the site- and also, er, let them see that appeal...

With a little jiggery-pokery, yep.

The below plugin allows you to redirect members of a group to a specific url

So, if your ban process currently involves also manually moving banned users off to a group then you're golden.

If, however, your process doesn't currently involve also manually moving banned users to a group then you could use the Rules application by @Kevin Carwile to intercept the ban action to move a user to a group upon them being banned.


Link to comment
Share on other sites

Is it possible to further customise the error page, for example showing a more detailed custom message, or an image, depending on the error that was generated? 

For example, I may wish to display different specific content for a 404 error than you would for another error message.

Link to comment
Share on other sites

You can view the code of the original error page and get access to the error codes so that you can display different specific content for error types by navigating to your theme, editing the HTML and CSS, and then navigating to core -> front -> global -> error. 

Unfortunately IPS doesn't provide a full list of the error codes, but a user posted a list in the thread below that you can check out.


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...