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.