Trouble Displaying Class Attributes From A Fetch

Author Message

Clay Pereira

Friday 06 February 2004 4:42:27 pm

Please help I am have trouble understanding how to work with the object model.

I have a list of info pages that list out correctly with the url link I want to add my chapter attribute to this. ie it would display Chapter 1 - EZ plubish Classes Chapter2 templast ect... This is what I have tried "chapter" is my attribute name in the info_page class. Thank you for the help..

{let category_list=fetch('content','tree', hash( parent_node_id, 106,
"sort_by", array(array('attribute',true(),161)),
class_filter_type, include,
class_filter_array, array( 'info_page' ) ) )}

<div id="contentmenu">
{section var=category loop=$category_list}
<ul>
<li class="{$category.sequence}">
{$category_list.object.data_map.chapter}
<a href={$category.item.url_alias|ezurl}>{$category.item.name|wash</a>
</li>
{/section}
</ul>
</div>
{/let}

Marco Zinn

Saturday 07 February 2004 2:56:00 am

Hi, did i understand correctly?
You inserted a new attribute (chapter) into the folder class and want to print the content of that attribute in the folder list (Table of contents)?

You have some bugs in your template code.
First, the <ul> should be before the section beginning. Or you will get multiple ul's, but just one /ul and this is not valid HTML

Your main problem: When you want to access the "chapter" data, you should use $category.item.object.data_map.chapter (or $category.item.data_map.chapter, i never remember).

You try to use category_list, which will give you access to the LIST (or array), but you need the individual (current) item.
Search the documentation for "data_map" for more info.
$category.item.object.data_map.chapter will give you access to the attribute, but you probably cannot print this directly. If it's a simple attribute type (textline), then you can try $category.item.object.data_map.chapter.output. If not, use attribute_view_gui. Again, search the docu for "data_map" and "attribute_view_gui" for more detailled info.

Marco
http://www.hyperroad-design.com

Clay Pereira

Saturday 07 February 2004 4:02:30 pm

Thank you Marco for getting me on the right track.I used the following and it works.
{attribute_view_gui attribute=$category.item.object.data_map.chapter}

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 18 2025 21:15:38
Script start
Timing: Jan 18 2025 21:15:38
Module start 'layout'
Timing: Jan 18 2025 21:15:38
Module start 'content'
Timing: Jan 18 2025 21:15:39
Module end 'content'
Timing: Jan 18 2025 21:15:39
Script end

Main resources:

Total runtime0.7534 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0057 589.1953152.6406
Module start 'layout' 0.00570.0034 741.835939.4766
Module start 'content' 0.00910.7429 781.3125538.1484
Module end 'content' 0.75200.0014 1,319.460912.4375
Script end 0.7534  1,331.8984 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.4653160.0002
Check MTime0.00140.1801160.0001
Mysql Total
Database connection0.00070.097610.0007
Mysqli_queries0.697592.5799570.0122
Looping result0.00070.0880550.0000
Template Total0.715595.020.3578
Template load0.00220.290420.0011
Template processing0.713394.677420.3567
Template load and register function0.00020.026810.0002
states
state_id_array0.00110.152110.0011
state_identifier_array0.00100.127820.0005
Override
Cache load0.00190.2477350.0001
Sytem overhead
Fetch class attribute can translate value0.00080.109220.0004
Fetch class attribute name0.00210.280240.0005
XML
Image XML parsing0.00070.094120.0004
class_abstraction
Instantiating content class attribute0.00000.001240.0000
General
dbfile0.00310.4067160.0002
String conversion0.00000.005340.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/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
5content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 17
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs