Fetching unique nodes with tree

Fetching unique nodes with tree

Thursday 14 August 2003 1:44:38 am - 4 replies

Modified on Thursday 14 August 2003 1:47:53 am by Roy Viggo Pedersen

Author Message

Tristan Koen

Thursday 14 August 2003 3:06:55 am

Hi Roy,

I haven't tested this, but perhaps the array operator unique() will work?

Try
{let nodelist=unique(fetch(content, tree, hash(
parent_node_id, 2,
class_filter_type, include,
class_filter_array, array( 2 )
))}

Roy Viggo Pedersen

Thursday 14 August 2003 11:26:38 am

Hi,

No, that wont work, as they are two different nodes ponting to the same contentobject. I checked in excontentobject_tree.

I only want one node (the one with main placement) for each contentobject_id.

Can this be done?

Roy

Tristan Koen

Friday 15 August 2003 5:22:43 am

Hi Roy,

Good point. I'm sure there is a better way to do this, but you could always take the brute-force approach.

1. Get a list of node_id's as you would normally.
2. Get the object_id for each of the node_id's and put it into an array.
3. Use the unique operator to filter out the duplicates.

From there you should be able to loop through the array and display the items you want.

Mads Buus Jensen

Wednesday 27 August 2003 3:10:28 am

Just a thought:

Usually your 'main nodes' and your 'other placement' have different depths in your tree, use the depth parameter on your fetch.

Also if 'main node' are kept together, create a class for this 'main node container', and then start by fetching that container.

Hope it helps (It did for me)

-Mads

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.