selection in fetch" function

Author Message

Roberta Gatti

Thursday 04 March 2004 7:12:02 am

Hi,
when I use a "fetch" function can I select only data of a specific datatype?

TIA
r.

Alex Jones

Thursday 04 March 2004 7:57:35 am

Yes you can use a <i>class_filter</i> to ensure you only fetch objects of the class (datatype) you want. For example, I have a fetch that only pulls objects of an image class (which happens to be id '5') from a specific folder (which has an id of '522'):

SiteTitleHeader=fetch(content,tree,hash(parent_node_id,522,class_filter_type,include,class_filter_array, array(5)))

Check out the documentation for fetch:
http://ez.no/ez_publish/documentation/development/libraries/ez_template/operators/data_fetch
http://www.ez.no/developer/ez_publish_3/documentation/customization/tips_tricks/fetch_function_examples

There is also a lot of information in the forums and the site as a whole, so a search should provide you with a wealth of data and examples.

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

Paul Borgermans

Thursday 04 March 2004 8:44:57 am

And if you want to select objects of a certain class but need to filter based on certain values of attributes (datatypes), you can do that too.

Check the docs that Alex pointed to and also this one:

http://ez.no/ez_publish/documentation/reference/data_fetching/content/list

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

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 00:57:10
Script start
Timing: Jan 19 2025 00:57:10
Module start 'layout'
Timing: Jan 19 2025 00:57:10
Module start 'content'
Timing: Jan 19 2025 00:57:10
Module end 'content'
Timing: Jan 19 2025 00:57:10
Script end

Main resources:

Total runtime0.7430 sec
Peak memory usage4,096.0000 KB
Database Queries59

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0047 589.1563152.6250
Module start 'layout' 0.00470.0033 741.781339.4453
Module start 'content' 0.00800.7336 781.2266574.8203
Module end 'content' 0.74160.0013 1,356.046912.1641
Script end 0.7430  1,368.2109 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.4266160.0002
Check MTime0.00130.1696160.0001
Mysql Total
Database connection0.00060.080110.0006
Mysqli_queries0.696093.6769590.0118
Looping result0.00060.0826570.0000
Template Total0.711895.820.3559
Template load0.00210.279020.0010
Template processing0.709795.521320.3549
Template load and register function0.00020.026110.0002
states
state_id_array0.00170.223810.0017
state_identifier_array0.00080.110120.0004
Override
Cache load0.00170.2300220.0001
Sytem overhead
Fetch class attribute can translate value0.00060.078930.0002
Fetch class attribute name0.00130.174650.0003
XML
Image XML parsing0.00110.150530.0004
class_abstraction
Instantiating content class attribute0.00000.001550.0000
General
dbfile0.00080.1106230.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
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 15
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs