How to fetch content by the custom property in php

Author Message

xiaoshitou xiaoshitou

Sunday 21 March 2010 11:46:45 pm

I create a custom class that names "News" and it own a property calls "Date", in tpl, i can fetch the content sort by date as follow:{set $children=fetch( content, list, hash( 'parent_node_id', $object.main_node_id, 'limit', $limit, 'offset', $offset, 'language', $currentlanguage, 'sort_by', array( 'attribute', false(), 'news/date' ) ) ) }but how to fetch it sort by date in php? I try several ways but not correct:$sort = array( 'attribute', true, 'date' );$treeParameters = array ('Offset' => false,'OnlyTranslated' => false,'Language' => $countryCd,'Limit' => false,'Limitation' => null,'class_id' => false,'SortBy' => $sort,'AttributeFilter' => false,'ExtendedAttributeFilter' => false,'ClassFilterType' => "include",'ClassFilterArray' => false,);or$treeParameters = array ( ......'SortBy' => array( 'attribute' => 'News/Date' ),......);or$treeParameters = array ( ......'SortBy' => array ('News/Date','Ascending'),......);Anyone who knows that please help me, many thanks!

Norbert Wagner

Monday 22 March 2010 3:34:03 am

Hi xiaoshitou,
please use code blocks when you write code in the forums.

To your question:

array('SortBy' => array('attribute', true, 'news/date'))

should work.

Not sure if you tried this, though.

Regards,
Norbert

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