Forums / Setup & design / attribute_filter and ObjectRelationList

attribute_filter and ObjectRelationList

Author Message

Ulrich L.

Thursday 24 February 2005 1:56:11 pm

Can anybody help me? I'm looking for the right piece of code.
I placed information on titles and information on CDs in different places in the content tree (for good reasons...). In the CD class, there is an Object relationList attribute "list of titles" whose members point to certain titles.
While showing a title I would like to show the CD (or CDs) where the list of titles contains this certain title. How do I have to set the attribute_filter?

{let cds_containing_this_title=
   fetch( 'content', 'list', hash( parent_node_id, 94, depth, 7,
   attribute_filter, array( array( 'cd/list_of_titles'???, '???', ???) ) ) ) }

Ɓukasz Serwatka

Tuesday 01 March 2005 11:32:14 pm

Hi Uli,

This code should work. $cd store information about CD information. You can fetch it as normal node.

{let cds_containing_this_title=fetch( 'content', 'list', 
                                       hash( parent_node_id, 94, depth, 7, 
                                       attribute_filter, array( array( 'cd/list_of_titles', '=', $cd.contentobject_id) ) ) ) }

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

Ulrich L.

Thursday 03 March 2005 2:10:15 pm

Luke, thank you for your answer.
("ez crew member": Congratulations!!)

However, the code above always gives back the complete list of all CDs, without filtering it.

When using the expresion 'cd/list_of_titles' it gives back an ObjectRelationList attribute, so I assume I cannot use '=' as filter parameter, right?

Do I have to loop all CDs and do a dedicated fetch command from every CD's ObjectRelationList? :-(

Thanks for an answer.

Ulrich L.

Friday 04 March 2005 3:13:46 pm

Perhaps this would help too:
How can I fetch the objects of an ObjectRelationList, so I can loop them?

{let my_objectrelationlist=fetch('content','list', ???)}
{section name=loop_on_objectrelationlist loop=example}
...
{/section}

Gabriel Ambuehl

Saturday 05 March 2005 12:21:47 am

Look into the templates for objectrelationlist. Inside should be a loop, you could then filter by hand I guess.

Visit http://triligon.org

Ulrich L.

Saturday 05 March 2005 1:52:51 am

I did it this way now, however there is much looping involved:

{* title - Line view *}

<div class="content-view-line">
    <div class="class-product">

        <h4>{$node.name|wash()}</h4>

        {let all_cds=fetch('content', 'tree', hash(parent_node_id, 94, class_filter_type, include, class_filter_array, array('cd')))}

        {section var=cd loop=$all_cds}

           {let current_list_of_titles=$cd.object.data_map.list_of_titles.content.relation_list}

           {section var=current_title loop=$current_list_of_titles}

              {section show=$current_title.contentobject_id|eq($node.contentobject_id)}
                {node_view_gui view='line' content_node=$cd}
              {/section}

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


   </div>
</div>

If anybody has got a suggestion how to do this with less looping, you are welcome to post here...