Thursday 09 March 2006 11:20:16 am - 4 replies
Hi all,
I want to fetch the newest object of a certain class in a certain folder, and I need to do it with PHP as it's part of a module.
Let's say I have a content class "letter" with ID=21, and I have a bunch of objects of this class that are published under a certain folder. Now I need to fetch the newest one.
Any help is helpful and appreciated!
Felix
Thursday 09 March 2006 11:30:57 am
Hi Felix,
Use eZContentObjectTreeNode
$parentNodeID = 123; $objects =& eZContentObjectTreeNode::subTree( array( 'ClassFilterType' => 'include', 'ClassFilterArray' => array( 'letter' ), 'SortBy' => array( 'published', false ), ), $parentNodeID );
Modified on Thursday 09 March 2006 11:31:40 am by Ćukasz Serwatka
Thursday 09 March 2006 12:42:45 pm
Loop throw $objects array
foreach( $objects as $object )
{
$dataMap =& $object->attribute( 'data_map' );
//image attribute
$image = $dataMap['image']->content();
// email attribute
$email = $dataMap['email']->content();
var_dump($dataMap);
}
You must be logged in to post messages in this topic!