Share » Forums » Setup & design » looking for a better way of writing...

looking for a better way of writing this code...

looking for a better way of writing this code...

Thursday 30 August 2007 7:26:29 am - 3 replies

Author Message

André R.

Thursday 30 August 2007 8:06:37 am

No, the id is actually 54 on ezwebin sites.
Try doing something like this:

$classID = eZContentObjectTreeNode::classIDByIdentifier( 'template_look' );
$obj = eZContentObject::fetchFilteredList( array( 'contentclass_id' => $classID ), 0, 1 );
$dataMap = $obj->dataMap();
$matrix = $dataMap['my_matrix']->content();

PS: The first line is cached by ez publish, so normally no database lookup.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Pascal Specht

Thursday 30 August 2007 8:34:09 am

Hi André,

Thank you very much. That was indeed what I was looking for!

		$classID = eZContentObjectTreeNode::classIDByIdentifier( 'common_ini_settings' );
		$chosenNodeList    = eZContentObject::fetchFilteredList( array( 'contentclass_id' => $classID ), 0, 1 );
		$chosenNode = $chosenNodeList[0];

-Pascal

André R.

Thursday 30 August 2007 11:32:10 am

Ahh, forgot that it's a array, my bad ;)
But its a array of content objects, not nodes.

$classID = eZContentObjectTreeNode::classIDByIdentifier( 'common_ini_settings' );
$chosenObjectList   = eZContentObject::fetchFilteredList( array( 'contentclass_id' => $classID ), 0, 1 );
$chosenObject = $chosenObjectList[0];

Nodes are what you get when use the eZContentObjectTreeNode fetch functions.
Or fetching it from the object like this:

$chosenMainNode = $chosenObject->attribute('main_node');

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu