'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

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 19 2025 09:54:05
Script start
Timing: Jan 19 2025 09:54:05
Module start 'layout'
Timing: Jan 19 2025 09:54:05
Module start 'content'
Timing: Jan 19 2025 09:54:06
Module end 'content'
Timing: Jan 19 2025 09:54:06
Script end

Main resources:

Total runtime0.6359 sec
Peak memory usage4,096.0000 KB
Database Queries69

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0070 589.1563152.6250
Module start 'layout' 0.00700.0040 741.781339.4609
Module start 'content' 0.01090.6231 781.2422564.5234
Module end 'content' 0.63400.0019 1,345.765616.1563
Script end 0.6359  1,361.9219 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00360.5684160.0002
Check MTime0.00140.2193160.0001
Mysql Total
Database connection0.00090.147210.0009
Mysqli_queries0.554787.2213690.0080
Looping result0.00080.1225670.0000
Template Total0.592593.220.2963
Template load0.00300.472520.0015
Template processing0.589592.703220.2948
Template load and register function0.00010.018610.0001
states
state_id_array0.00130.202410.0013
state_identifier_array0.00150.235420.0007
Override
Cache load0.00250.3997580.0000
Sytem overhead
Fetch class attribute can translate value0.00050.074220.0002
Fetch class attribute name0.00140.215980.0002
XML
Image XML parsing0.00200.313920.0010
class_abstraction
Instantiating content class attribute0.00000.0031100.0000
General
dbfile0.00801.2559160.0005
String conversion0.00000.001840.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
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
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_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