Forums / Developer / Fetch content by Section ID

Fetch content by Section ID

Author Message

Muhammad Khalid Majeed

Tuesday 04 May 2004 11:41:48 pm

I am create different folder and assign one section more than 1 folder. Now i need to fetch contents from all folders. Now I have option that i set multiple commands like

{let new_release=fetch(content,list, hash( parent_node_id,
$node.parent_node_id, sort_by, array(
published, false() ), class_filter_type, include,
class_filter_array, array( 'article')))}

for each folder. But Is it possible that i can fetch contents from all folder by selecting Section ID? I have try this by no result

{let new_release=fetch(content,list, hash( section_id,
$node.object.section_id, limit,11, sort_by, array(
published, false() ), class_filter_type, include,
class_filter_array, array( 'article')))}

for this My work will be easy and if my folders will increase then my old code will be work.

Muhammad Khalid
Software Engineer
www.webgurru.net

Bruce Morrison

Wednesday 05 May 2004 12:15:06 am

It doesn't appear that you can.

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

You can loop through the results of the fetch and only display nodes that belong to a specific section.

Cheers
Bruce http://www.designit.com.au/

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Muhammad Khalid Majeed

Wednesday 05 May 2004 3:06:13 am

Thanks Bruce

But the URL you wrote only documented related lists. there is nothing to fetch contents using section ID. Also I can't understand the idea which you said to loop by section id.

If you have any example code then plz send it. Or have anyother idea.

Muhammad Khalid
Software Engineer
www.webgurru.net

Jan Borsodi

Wednesday 05 May 2004 4:50:13 am

You should be able to do it by using the attribute_filter and matching on 'section',
try the the following fetch

fetch( content, tree,
       hash( parent_node_id, $node.parent_node_id,
             sort_by, array( published, false() ),
	     attribute_filter, array( 'and', array( 'section', '=', $node.object.section_id ) ),
             class_filter_type, include,
	     class_filter_array, array( 'article' ) )  )

This uses <i>tree</i> fetching to fetch all objects under that node and not just the ones as direct chidren.

--
Amos

Documentation: http://ez.no/ez_publish/documentation
FAQ: http://ez.no/ez_publish/documentation/faq

Kevin Myles

Friday 23 July 2004 10:02:25 am

I found this post by Jan very helpful when I wanted to tweak my main menu to only show a particular section in my menu. Of course, it'll work for any fetch.

However i found that I had to replace the $node.object.section_id with the node I wanted, as follows:

      {let menuitems=fetch( 'content', 'list', hash( 'parent_node_id', 2,
                                                   'sort_by', $root_node.sort_array, attribute_filter, array( 'and', array( 'section', '=', 1 ) ),
class_filter_type, include,
                                                   class_filter_array, array( 'folder' ) ) )}

eZ debug

Timing: Jan 18 2025 18:24:00
Script start
Timing: Jan 18 2025 18:24:00
Module start 'content'
Timing: Jan 18 2025 18:24:02
Module end 'content'
Timing: Jan 18 2025 18:24:02
Script end

Main resources:

Total runtime2.0924 sec
Peak memory usage4,096.0000 KB
Database Queries204

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0073 588.8281180.8359
Module start 'content' 0.00731.8325 769.6641640.1875
Module end 'content' 1.83980.2525 1,409.8516337.0625
Script end 2.0923  1,746.9141 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00420.1992210.0002
Check MTime0.00140.0664210.0001
Mysql Total
Database connection0.00100.047510.0010
Mysqli_queries2.013996.24752040.0099
Looping result0.00230.10872020.0000
Template Total2.056698.321.0283
Template load0.00180.085720.0009
Template processing2.054898.204021.0274
Template load and register function0.00030.013710.0003
states
state_id_array0.00180.084810.0018
state_identifier_array0.00200.094620.0010
Override
Cache load0.00150.0729350.0000
Sytem overhead
Fetch class attribute can translate value0.00160.075450.0003
Fetch class attribute name0.00140.068170.0002
XML
Image XML parsing0.00160.077550.0003
class_abstraction
Instantiating content class attribute0.00000.000670.0000
General
dbfile0.00380.1831340.0001
String conversion0.00000.000330.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
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
9content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/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: 24
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs