how to retrieve all the attribute names and value in my template

how to retrieve all the attribute names and value in my template

Wednesday 04 August 2004 3:22:29 am - 1 reply

Author Message

Philip Redmon

Thursday 12 August 2004 9:01:03 am

Here are some code snips from my template. If I understand the question, you are displaying one object from the class? Or are you wanting to display a list of your objects, and display all the attributes of each object? Either way:

For showing attributes of specific objects:

{section name=ShowAttribute loop=$:item.contentobject_version_object.contentobject_attributes}
{attribute_view_gui attribute=$:item<br />
{$:item.contentclass_attribute.name|wash}
{/section}

For showing attributes for a list of objects

{let numberOfObjects=10}
{let collectionCount=fetch( 'content', 'list_count',
                         hash( 'parent_node_id', $node.node_id ) )}
{let collectionList=fetch( 'content', 'list', hash( 'parent_node_id', $node.node_id,
                                                 'sort_by', $node.sort_array,
                                                 'offset', $view_parameters.offset,
                                                 'limit', $numberOfObjects ) )}
<table width=100% border=1 bordercolor=#660000 cellpadding=10 cellspacing=0>

{* Loop through all the entries. *}
{section name=collectionLoop loop=$collectionList}

<tr><td>

{* grab and show all attributes for this object *}
{section name=ShowAttribute loop=$:item.contentobject_version_object.contentobject_attributes}
{attribute_view_gui attribute=$:item<br />
{$:item.contentclass_attribute.name|wash}
{/section}

</td></tr>

{* End of loop. *}
{/section}

</table>

{/let}
{/let}
{/let}

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

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