Forums / Developer / How to fetch content by the custom property in php

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

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