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.

eZ debug

Timing: Jan 31 2025 02:43:27
Script start
Timing: Jan 31 2025 02:43:27
Module start 'content'
Timing: Jan 31 2025 02:43:27
Module end 'content'
Timing: Jan 31 2025 02:43:27
Script end

Main resources:

Total runtime0.2080 sec
Peak memory usage8,192.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0066 587.9297370.3047
Module start 'content' 0.00660.0097 958.23441,005.4375
Module end 'content' 0.01630.1916 1,963.67193,894.6719
Script end 0.2079  5,858.3438 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00422.0426200.0002
Check MTime0.00120.5916200.0001
Mysql Total
Database connection0.00060.301110.0006
Mysqli_queries0.130262.60301410.0009
Looping result0.00110.52991390.0000
Template Total0.191392.010.1913
Template load0.00070.316910.0007
Template processing0.190791.692710.1907
Override
Cache load0.00050.227510.0005
Sytem overhead
Fetch class attribute can translate value0.00170.833310.0017
XML
Image XML parsing0.00020.104810.0002
General
dbfile0.00281.3311200.0001
String conversion0.00000.003130.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs