eZ Community » Forums » General » Excluding nodes from a list fetch?
expandshrink

Excluding nodes from a list fetch?

Excluding nodes from a list fetch?

Tuesday 05 May 2009 4:55:20 am - 6 replies

We have 2 list fetches and want to exclude nodes from the first fetch in the second fetch. The parent_node_ids are the same as well as the class_attribute_filter. Is there anyway to do this without an extended attribute filter or unnecessarily fetching the same node twice?

Ideally we would pass an array of node ids to the second fetch and these would be excluded.

Tuesday 05 May 2009 8:30:10 am

This is not possible I'm afraid. You have to use extended attribute filter if you want to filter on specific node ids. I don't know details behind your implementation logic, but it might be also possible to use offset and max params for foreach template function if you want to skip some first nodes in second loop. Then only one fetch could be used.

Modified on Tuesday 05 May 2009 8:30:49 am by Łukasz Serwatka

Tuesday 05 May 2009 5:07:07 pm

Hey Łukasz,

I was able to use the offset method in a couple tpl locations but we also have an eZ Flow zone with 2 dynamic blocks that could benefit from this. Both blocks use eZFlowLatestObjects -- same class and parent; just a different number of active results.

Tuesday 05 May 2009 5:26:22 pm

What about writing a custom template function optimized for your fetch? That also enables you to tune the query for your situation and optimize for memory usage and performance.

-bård

Tuesday 05 May 2009 5:37:59 pm

for exclude nodes from list fetch, you can use path in your attribute_filter.

attribute_filter, array( array( 'path', 'not_in', array( path_string, path_string) )

I don't know for the performance of this method.

Wednesday 24 September 2014 12:17:29 am

Hello,

I just wanted to file a note here that I used Frédéric' attribute filter suggestion today and it worked perfectly for me! I used this attribute filter for example:

'attribute_filter', array( array( 'path', 'not_like', '*/220/*' ) ),

I hope this helps!

Cheers,
Heath 

Monday 13 October 2014 4:12:16 am

Hello,

Brief update here. After some time we found we needed to exclude more than one node path and switched to a section based exclude which we think is simpler to maintain and use. Re: less template changes based on content changes.

'attribute_filter', array( array( 'section', '!=', '7' ) ),

I hope this helps!

Cheers,
Heath 

expandshrink

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

36 542 Users on board!

Forums menu

Proudly Developed with from