Share » Forums » Install & configuration » 'Module not found' override

'Module not found' override

'Module not found' override

Monday 13 March 2006 1:54:33 am - 8 replies

Author Message

Heiner Wurbs

Monday 13 March 2006 2:09:11 am

Hi,
you can set this in the site.ini:

[SiteSettings]
DefaultPage=/content/view/full/2/
ErrorHandler=defaultpage

Set here the ErrorHandler to the defaultpage, then the module not found will not displayed
Heiner

Christian Johansen

Monday 13 March 2006 2:22:25 am

Isn't the default page also the page that users are redirected to when they log in? Isn't it possible to create a default error-page that is only used in case of errors?

Marc Boon

Monday 13 March 2006 3:21:35 am

Exactly!
'Module not found' generates a '404 Not Found' header, which is correct. So it should not show the default page, but a custom error page.
Normally, you would just create an override, but what are the override match conditions for the 'Module not found' template?

Marc Boon

Wednesday 15 March 2006 1:33:45 am

ErrorHandler=defaultpage does redirect to the defaultpage on an error, but with a 200 OK response.
How do I generate a custom error page with a 404 Not Found response?

Bruce Morrison

Wednesday 15 March 2006 1:58:18 am

Hi Marc

Have a look at error.ini I suspect you will be able to tweak some settings there to suit your needs.

Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Marc Boon

Wednesday 15 March 2006 3:37:12 am

Thanks for the tip!

I created a error.ini.append.php in my siteaccess/override folder (actually, in my extension/site/settings/override folder, since I use a extension for the common settings of my multilingual site). It looks like this:

[ErrorSettings-kernel]
# 404 handler for 'module not found'
ErrorHandler[20]=rerun
RerunURL[20]=/content/view/full/380

The rerun handler assures that the correct HTTP response '404 - Not Found' is send.

In my override.ini.append.php, I have specified a override template for error pages, which are Folder objects, contained in a Folder with node id 379:

# content/view/full template for error pages
[error_page]
Source=node/view/full.tpl
MatchFile=error_page.tpl
Subdir=templates
Match[parent_node]=379

I create a Folder object for each error, with the error code as short_name, the error message as name, and a optional short and long description. The 404 folder has node id 380.
In the template file error_page.tpl, I display the folder attributes in my site style, embedded in the sites pagelayout template.
Since I run a multilingual site, all attributes are also translated, so each language's siteaccess gets the error messages in the correct language.

Works like a charm!

John Kazakis

Thursday 03 April 2008 4:11:46 am

Marc,

I have used to your method successfully, however you mention "errors", have you been able to replace "access denied" errors with this same method? If so, how?

Thanks.

Stefan Eickhoff

Friday 25 April 2008 9:32:44 am

Hi,

it took me some time to figure out why this did not work on my eZ 4.0

there is an issue concerning this

http://issues.ez.no/IssueView.php?Id=12605&activeItem=1

it is fixed in the trunk version

http://pubsvn.ez.no/nextgen/trunk/lib/ezutils/classes/ezmodule.php

enjoy the day

Stefan

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu