5329 Posts in 1601 Topics by 1169 members
|Go to End|
4 May 2009 at 4:40pm Last edited: 8 May 2009 1:56pm
P.S. For another 404 question, see: http://silverstripe.org/customising-the-cms/show/259762
4 May 2009 at 9:51pm
Another Ronan on the forum? Damn, I was sure I would be unique for a while longer!
Ok, so what you want to do is create an ErrorPage type in your theme:
1) in the \themes\YOURTHEME\templates folder, you should see at least a Page.ss - copy this and rename the copy as ErrorPage.ss
2) in the \themes\YOURTHEME\templates\Layout folder - there will be another Page.ss - again make a copy as an ErrorPage.ss
The Page.ss in the ./templates directory is the main holder file. This will contain the <head> tags to which you can add in a bit of Jscript to redirect to the home page after 10 seconds or whatever you need.
The downside to this is that you will now have two main files in the ./templates directory to maintain. Most page types can work off the standard Page.ss one, only requiring a files in the Layout folder, but aside from that, should work fine.
Don't forget to append ?flush=1 to the querystring to see the changes take effect.
5 May 2009 at 12:24pm
P.S. Good name, btw, I love the fact that it's exotic in NZ, I know far too many Ronans at home - kinda like the Irish equivalent of Dave in NZ...
8 May 2009 at 1:55pm
See my other post http://silverstripe.org/customising-the-cms/show/259762 regarding the issue of emailing the sysadmin when a site error occurs. The following code can be added in after the mail command so that the user is redirected to the front page of the site after 5 seconds.
// Once Email is sent, set up the redirect
$redirectDest = "/"; // i.e. homepage of site
$redirectDelay = "5000"; // 5000ms (5 sec) delay
$redirect = '
setTimeout(\'window.location = "'.$redirectDest.'"\','.$redirectDelay.')
if ($_GET["err_code"]=="404") echo $redirect; // Only do the redirect on 404 errors.
Hope this helps others.
|Go to Top|