Share » Forums » Developer » PHP: get nodes and compare to class_id

PHP: get nodes and compare to class_id

PHP: get nodes and compare to class_id

Wednesday 24 March 2010 7:33:09 am - 3 replies

Author Message

Bruce Morrison

Wednesday 24 March 2010 5:10:49 pm

Hi Jorge

The DB table that holds nodes is ezcontentobject_tree but you'll have to join this with ezcontentobject to access the class. Have a look at http://ez.no/doc/ez_publish/technical_manual/3_10/concepts_and_basics/content_management/the_content_node for some of the underlying info.

I'm not sure exactly what you are trying to achieve but typically in eZ Publish you utilise the API to retrieve data and don't do direct queries on the DB. The easiest way to retrieve the data you are after is a template fetch query from PHP:

$nodes = eZFunctionHandler::execute( 'content', 'tree',
    array( 'parent_node_id'     => $top_node_id,
           'class_filter_type'  => 'include',
           'class_filter_array' => array( 'article' ) ) );

As the filtering is done in the fetch there is no need to loop through the returned nodes and check class type.

This is quite flexible as you can utilise the same parameters as used in templates.

Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Jorge estévez

Thursday 25 March 2010 5:10:33 am

Thanks

Is there a way to donwload the whole API Reference instead of reading online?

Best Regards

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

Jorge estévez

Thursday 25 March 2010 5:15:18 am

Found at http://pubsvn.ez.no/doxygen/3.10/

thanks again!

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

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

36 542 Users on board!

Forums menu