Forums / Setup & design / How to customise error messages ?

How to customise error messages ?

Author Message

Xavier Dutoit

Tuesday 29 March 2005 12:01:13 am

Hi,

I'm trying to display a different message when the user tries to access a restricted area and when he tries to put a product in the basket.

The page involved in both case is the templates/errors/kernel/1.tpl (I've copied it into my custom design folder).

However, none of the variables I could think of (the usual suspects: module_result, view_parameters, uri_string, requested_uri_string) are set and designkeys only contains the section id.

How do I know that I'm in /shop/basked or in /private_area ?
On the log: I've got this message

"Warning: Insufficient permissions  	Mar 29 2005 09:52:33

Function required:
 Module : shop
 Function : buy
 ClassID : 
 MainNodeID : 
Policies that didn't match:

I want to be able to know on 1.tpl if I'm on the shop module or content one for instance, so I can customise the error message (the default one isn't the most selling one for a shop ;)

Any idea ?

X+

 

http://www.sydesy.com

Łukasz Serwatka

Tuesday 29 March 2005 3:16:38 am

Hi Xavier,

You can use sections and information stored in $parameters.

{section loop=$parameters.AccessList.FunctionRequired}
    {$item}
{/section}

For example if you want to show some information for Anonymous user who want access folder with node id 97

{section show=eq( $parameters.AccessList.FunctionRequired.MainNodeID, 97 )}
    Show something or include some tpl
{/section}

For shop

{section show=eq( $parameters.AccessList.FunctionRequired.Module, 'shop' )}
    Show something or include some tpl
{/section}

I hope it will help.

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Xavier Dutoit

Tuesday 29 March 2005 9:31:25 am

Hi,

thanks for your answer, I wasn't aware of the parameters variable. What is it ? Is that going to be covered in the doc ?

I don't quite really get why you haven't reused the same variables than the usual "module_result, view_parameters, uri_string, requested_uri_string" instead, but variable proliferation in ez is another topic altogether ;)

For the record, I found antother less elegant way:

{section show=eq($redirect_uri,"/shop/basket")}

Because I forgot to subscribe to this thread to get emails when someone post ;(

http://www.sydesy.com

Łukasz Serwatka

Wednesday 30 March 2005 5:41:17 am

New documentation is a part of 3.6 cycle and will contains lots of new content/material.

$parameters variable stores extra informaion about:
- function
- module
- polices

{$parameters|attribute}

Alternative, you can use string functions and fetch info about node (if exists).

{let uri_data=$redirect_uri|explode( '/' )
     node_data=fetch( content, node, hash( node_id, $uri_data[4] ) )}
	{$node_data.name}
{/let}

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Nathan Kelly

Friday 04 November 2005 7:43:00 pm

Hi, is there any way to override error messages, I don't want to change core files even if its only cosmetic text changes, so if there is a way to override them.

The message in question is kernel(20) among others, the reason is that if a user is presented with a statement like "This site uses siteaccess matching in the URL and you didn't supply one, try inserting a siteaccess name before the module in the URL ." how on earth will they know what "siteaccess" means?

What i'd like to do is replace this statement with a message such as "try searching the site" and place a search form on the "module not found" page, I think this would be more user friendly.

Is there any way this could be done?

Cheers!

Pardon me while I burst into flames...

eZ debug

Timing: Jan 19 2025 03:19:17
Script start
Timing: Jan 19 2025 03:19:17
Module start 'content'
Timing: Jan 19 2025 03:19:18
Module end 'content'
Timing: Jan 19 2025 03:19:19
Script end

Main resources:

Total runtime1.3399 sec
Peak memory usage4,096.0000 KB
Database Queries202

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0057 588.9688180.8359
Module start 'content' 0.00571.2259 769.8047631.2109
Module end 'content' 1.23160.1082 1,401.0156341.3984
Script end 1.3398  1,742.4141 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00370.2754210.0002
Check MTime0.00140.1046210.0001
Mysql Total
Database connection0.00080.058410.0008
Mysqli_queries1.259894.02272020.0062
Looping result0.00170.12742000.0000
Template Total1.308597.720.6542
Template load0.00180.133220.0009
Template processing1.306797.520520.6533
Template load and register function0.00010.007810.0001
states
state_id_array0.00090.065810.0009
state_identifier_array0.00140.102720.0007
Override
Cache load0.00150.1139500.0000
Sytem overhead
Fetch class attribute can translate value0.00130.094540.0003
Fetch class attribute name0.00110.085580.0001
XML
Image XML parsing0.00180.134640.0005
class_abstraction
Instantiating content class attribute0.00000.0013100.0000
General
dbfile0.00460.3447410.0001
String conversion0.00000.000430.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
5content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
13content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
7content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 34
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs