Forums / Setup & design / 'advanced' fetch function problem

'advanced' fetch function problem

Author Message

Alessandro Cipriani

Thursday 22 April 2004 2:55:45 am

hi all
i have 2 classes: article and article2, both with a checkbox attribute called "publish_on_frontpage".
in my home page i'd like to have a fetch function that fetches articles and articles2 with the 'publish_on_frontpage' checkbox checked.
that's the fetch function code:

{let news_list=fetch( content, tree, hash( parent_node_id, 2,
                                           limit, 1,
                                           attribute_filter, array(array( 'article/primo_piano', '=', true(),
                                                                          'article2/primo_piano', '=', true() ) ),
                                           sort_by, array( published, false() ) ) )}

 

no problem if there is an article checked as published on frontpage, but if i'd like to have an article2 it isn't published there.

how can i fetch object of these 2 classes by the 'publish_on_frontpage' checkbox?

best regards
alessandro

Paul Forsyth

Thursday 22 April 2004 3:06:48 am

I think you need a conditional operator as part of your attribute_filter.

Eg

attribute_filter, array(array( 'or', 'article/primo_piano', '=', true(),
                                     'article2/primo_piano', '=', true() ) )

See the doco for this:

http://ez.no/ez_publish/documentation/development/libraries/ez_template/operators/data_fetch

Without this i think the filter just matches on the first condition, though i could be wrong. I haven't used it yet.

paul

--
http://www.visionwt.com

Alessandro Cipriani

Thursday 22 April 2004 3:43:04 am

hi paul

following your suggestion i wrote:


				   {let news_list=fetch( content, tree, hash( parent_node_id, 2,
															  limit, 1,
															  attribute_filter, array('or', array( 'article/primo_piano', '=', true()), array( 'article/prodotti', '=', true() ) ),
															  sort_by, array( published, false() ) ) )}

and it's working.
but this code fetches objects by 2 attributes of the SAME object (article)
if i try to write 'article2/primo_piano' instead 'article/prodotti' i don't get anything...

any suggestion?

best regards
alessandro

Paul Forsyth

Thursday 22 April 2004 4:05:36 am

As you have added a new class have you added this class to your permissions for your current user? If you dont have the role permissions set it wont be returned.

paul

--
http://www.visionwt.com

Alessandro Cipriani

Thursday 22 April 2004 4:53:17 am

yes paul
the new class (article2) is displayed without problems by all. The example you suggested me is about two attributes of the same class, while my need is to fetch two attributes of two different classes.
i think that this a sintax problem...

any hint?
cheers
alessandro

Paul Forsyth

Thursday 22 April 2004 5:05:18 am

Ah, i see. Well, the best thing is to use two fetchs then, one for each class. Once you have this you can check the arrays and do the appropriate action.

paul

--
http://www.visionwt.com

Paul Forsyth

Thursday 22 April 2004 5:07:48 am

Might also be worth filing a bug about this. The fetch doesn't seem to be doing what it should be doing.

paul

--
http://www.visionwt.com

eZ debug

Timing: Jan 19 2025 07:27:07
Script start
Timing: Jan 19 2025 07:27:07
Module start 'content'
Timing: Jan 19 2025 07:27:08
Module end 'content'
Timing: Jan 19 2025 07:27:08
Script end

Main resources:

Total runtime0.9737 sec
Peak memory usage4,096.0000 KB
Database Queries206

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0071 588.9688180.8359
Module start 'content' 0.00710.8570 769.8047569.6016
Module end 'content' 0.86410.1096 1,339.4063341.0859
Script end 0.9736  1,680.4922 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00480.4956210.0002
Check MTime0.00160.1678210.0001
Mysql Total
Database connection0.00060.064510.0006
Mysqli_queries0.893591.76332060.0043
Looping result0.00200.20072040.0000
Template Total0.940596.620.4703
Template load0.00250.254820.0012
Template processing0.938096.337120.4690
Template load and register function0.00010.008810.0001
states
state_id_array0.00160.160410.0016
state_identifier_array0.00120.123420.0006
Override
Cache load0.00230.2355580.0000
Sytem overhead
Fetch class attribute can translate value0.00180.188530.0006
Fetch class attribute name0.00130.130580.0002
XML
Image XML parsing0.00220.223230.0007
class_abstraction
Instantiating content class attribute0.00000.0024100.0000
General
dbfile0.00160.1602270.0001
String conversion0.00000.000530.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
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
7content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
10content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
17content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 42
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs