Forums / Developer / custom fetch of content nodes

custom fetch of content nodes

Author Message

Romeo Antony

Sunday 21 November 2010 3:15:07 am

Hi,

I am unable to setup a fetch function for my ezflow dynamic block. Hope some expert may do a help.

I want to fetch 4 nodes everytime to a dynamic block in ezflow.

These 4 nodes should be fetched based on some conditions.

Conditions are ,

1st node should be , it has a selection attribute whose value is 1.

2nd node should be , it has a selection attribute whose value is 2.

3nd node should be , it has a selection attribute whose value is 3.

4nd node should be , it has a selection attribute whose value is 4.

So evrytime there should be 4 nodes and each of them with unique selection attribute values as mentioned & latest published nodes .

I think the above criteria cannot be done with attribute filer. So I tried extended attribute filter, but no luck. Please help anyone by giving an idea.

the other solutions is to fetch all nodes with selection attribute value is not null.

Then in template filter the latest published nodes with if condition .But this will render a lot of system resources(obviously bez of time, cpu usage). .

Please give a suggestion.

ROmeo

Thiago Campos Viana

Monday 22 November 2010 2:59:19 am

How about using an "or" statement or using "between"?

eZ Publish Certified Developer: http://auth.ez.no/certification/verify/376924

Twitter: http://twitter.com/tcv_br

Romeo Antony

Monday 22 November 2010 3:24:02 am

Thanks for the reply Thiago.

At the very begnning I have thought about using or or between in fetch to sort this out.

But I will explain the problem

$subTreeParameters['AttributeFilter'] = array( 'or', array( 'article/catogary', '=', 0 ),array( 'article/catogary', '=', 1 ),array( 'article/catogary', '=', 2 ),array( 'article/catogary', '=', 3 ), );

the above AttributeFilter in ezflow fetch class , fetches nodes with all articles which has its selection value 0 or 1 or 2 or 3 . Suppose the case in which if I most recently published 4 articles with selection attribute value 3, then the above atrbute filter will fetch 4 nodes with selection attribute value 3. So I do not get 4 nodes with unique selection attribute values.

But I am looking to fetch 4 nodes each of them with unique selection attribute values.

means 1st node feched will be of selection attribute value 0

2nd be of selection attribute value 1

3nd be of selection attribute value 2

4nd be of selection attribute value 3

So OR is not a proper solution.

If I use between (0 to 3), it will not work. So between and or not work , for this criteria.

No idea till .

Thiago Campos Viana

Monday 22 November 2010 4:40:07 am

So, remains two options so far:

1 - Do 4 fetches and limit the results to 1.

2 - Create a custom fetch function.

eZ Publish Certified Developer: http://auth.ez.no/certification/verify/376924

Twitter: http://twitter.com/tcv_br

Romeo Antony

Monday 22 November 2010 7:01:02 am

First option "Do 4 fetches and limit the results to 1.".

That is better idea. First I will try it. But I think It will be little complicated to do. Anyway I will try it

Thanks a lot Thiago.