Custom error pages

Permalink 1 user found helpful
What are the recommended Best Practices for creating custom error pages (404, 401, etc)? Should these be Single Pages? Has anyone already developed an add-on for editing error pages?

ParaplegicRacehorse
View Replies:
dgaussin replied on at Permalink Reply
dgaussin
I did that last week for 404 pages.

Add the following line in your /config/site_theme_paths.php file

$v->setThemeByPath('/page_not_found', "my_theme");


And C5 will use the view.php file in your my_theme directory or page_not_found.php file if that exists.
argvader replied on at Permalink Reply
argvader
I created a custom error page and followed the guidelines above, but I didn't want the my page wrapped with the default template.

I had my entire error page already themed. for example :

http://www.theoryblister.com/nothing...

I had to change a core file however. I can contribute it back if that's something useful to others.
sirsyco replied on at Permalink Reply
If you did place some kind of example on how you did that argvader.... I'd like to know how you did it. and would find it Usefull!

Best!
mattl replied on at Permalink Reply
not recommended but this is how i did it, and it works well

in the page_not_found.php

i added this in the header



simple to redirect to your 404 page, quick easy for a client of mine, and on my personal site

edit:
i don't know code was added to my code but this is the code without the code tag
<?php
header( 'Location:http://www.yourdomain.com/location/of/error/page/404.html'... ) ;
?>
AlbertPotato replied on at Permalink Reply
AlbertPotato
Brass,
After using php's header function in /single_pages/page_not_found.php, were you still able to edit Content blocks? I've found that using header here breaks tiny_mce and I'm having to use meta-refresh instead which is less than ideal.
Remo replied on at Permalink Reply
Remo
AlbertPotato replied on at Permalink Reply
AlbertPotato
Excellent. Remo, thanks for posting that solution. Worked great for my situation.
admin replied on at Permalink Reply
Thanks Remo! I applied these customizations on my site. I didn't do anything fancy yet, but it's better than the default.

My question is, do I need to create individual setThemeByPath customizations for every possible error (403, 404, etc.)? Or will "page_not_found" cover them all?
nbruley replied on at Permalink Reply
Sorry for my ignorance... maybe I'm missing something, but I'm not getting the theme to carry over for my error 404 page. I added the following to the file you spec'd and made it functional by removing the comment.

$v->setThemeByPath('/page_not_found', "touching");

I checked to verify "touching" was the handle. Then I copied my default.php and made it page_not_found.php just to see if I could get the theme to carry over...

Can you help? My site is temporarily at:
http://gospelriver.mysitecreations.com/...
Thank you.