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.

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

eZ debug

Timing: Jan 18 2025 10:40:12
Script start
Timing: Jan 18 2025 10:40:12
Module start 'layout'
Timing: Jan 18 2025 10:40:12
Module start 'content'
Timing: Jan 18 2025 10:40:13
Module end 'content'
Timing: Jan 18 2025 10:40:13
Script end

Main resources:

Total runtime0.9365 sec
Peak memory usage4,096.0000 KB
Database Queries63

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0080 587.9141152.6250
Module start 'layout' 0.00800.0037 740.539139.4531
Module start 'content' 0.01170.9229 779.9922568.7734
Module end 'content' 0.93460.0018 1,348.765616.4766
Script end 0.9364  1,365.2422 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.3718160.0002
Check MTime0.00140.1522160.0001
Mysql Total
Database connection0.00100.111910.0010
Mysqli_queries0.863492.1997630.0137
Looping result0.00070.0733610.0000
Template Total0.898595.920.4492
Template load0.00220.230020.0011
Template processing0.896395.710820.4481
Template load and register function0.00010.011310.0001
states
state_id_array0.00130.135110.0013
state_identifier_array0.00140.144920.0007
Override
Cache load0.00180.1962470.0000
Sytem overhead
Fetch class attribute can translate value0.00090.097820.0005
Fetch class attribute name0.00250.266170.0004
XML
Image XML parsing0.00100.103220.0005
class_abstraction
Instantiating content class attribute0.00000.0028100.0000
General
dbfile0.00100.1097220.0000
String conversion0.00000.001240.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
5content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 17
 Number of unique templates used: 5

Time used to render debug report: 0.0003 secs