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' ) ) )}

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.