I can't catch the error

Author Message

Børge Warvik

Monday 30 January 2006 1:26:20 am

In a template I do this:

<div class="cbox">

<h3>Eksterne linker</h3>

{def $links=fetch('content', 'list', hash('parent_node_id', 84, 'sort_by', 'short_name', 'class_filter_type', 'include', 'class_filter_array', array('link')))}

<ul>
{foreach $links as $link}
<li><a href="{attribute_view_gui attribute=$link.object.data_map.url}">{attribute_view_gui attribute=$link.object.data_map.short_name}</a></li>
{/foreach}
</ul>
</div>

Everything is working fine, but my debug output gives me this error. The error is printed for each of the $link items of $links:

Error: eZTemplate @ design/nifab/override/templates/frontpage_full.tpl:13[13]
No such attribute for array(4): url
Choose one of following: name, short_name, description, location
Warning: eZTemplate:attribute_view_gui
Parameter attribute is not an object

What am I doing wrong?

Børge Warvik

Monday 30 January 2006 1:44:30 am

Figured this one out eventually :)

David Boman

Monday 30 January 2006 1:50:13 am

Can you give us some hints? I have a lot of these and I'm not really sure how to start debugging them...

Børge Warvik

Monday 30 January 2006 2:14:11 am

I was wrong! My code didn't work at all, it just looked like it did. It turned out that my $node didn't have a url attribute.

So printing the link like this:

<a href="{attribute_view_gui attribute=$link.object.data_map.url}"> {attribute_view_gui attribute=$link.object.data_map.name} </a>

Will give you links on the page, but if you view the the source you'll see:

<a href="">[name of link]</a>

It turns out that you need to use the attribute location, like this:

{attribute_view_gui attribute=$link.object.data_map.location}

That will give you all you need including wrapping the link in the a tag for you!

Hope that answers it

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 19 2025 04:22:39
Script start
Timing: Jan 19 2025 04:22:39
Module start 'layout'
Timing: Jan 19 2025 04:22:39
Module start 'content'
Timing: Jan 19 2025 04:22:40
Module end 'content'
Timing: Jan 19 2025 04:22:40
Script end

Main resources:

Total runtime0.8305 sec
Peak memory usage4,096.0000 KB
Database Queries60

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0099 589.1484152.6250
Module start 'layout' 0.00990.0044 741.773439.4453
Module start 'content' 0.01430.8148 781.2188520.8828
Module end 'content' 0.82910.0013 1,302.101612.1719
Script end 0.8304  1,314.2734 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00370.4440160.0002
Check MTime0.00140.1687160.0001
Mysql Total
Database connection0.00100.115110.0010
Mysqli_queries0.775293.3381600.0129
Looping result0.00060.0710580.0000
Template Total0.790895.220.3954
Template load0.00200.243120.0010
Template processing0.788794.972220.3944
Template load and register function0.00010.013110.0001
states
state_id_array0.00140.172410.0014
state_identifier_array0.00090.103420.0004
Override
Cache load0.00170.2036250.0001
Sytem overhead
Fetch class attribute can translate value0.00060.068220.0003
Fetch class attribute name0.00100.126250.0002
XML
Image XML parsing0.00100.120120.0005
class_abstraction
Instantiating content class attribute0.00000.002170.0000
General
dbfile0.00100.1263160.0001
String conversion0.00000.001840.0000
Note: percentages do not add up to 100% because some accumulators overlap

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
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
9content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
5content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 23
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs