Fetching main node id in script

Author Message

Eirik Alfstad Johansen

Thursday 22 January 2004 7:57:05 am

Hi,

I need to fetch the main node id for an object in a module, but when I use the following:

$object = eZContentObject::fetch( $object_id );

...the MainNodeID attribute of the object returned is emtpy.

Why does this happen, and are there any other ways to fetch the MainNodeID for an object?

Thanks in advance !

Sincerely,

Eirik Johansen

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

Roy Viggo Pedersen

Monday 26 January 2004 3:51:28 am

Hi,

It should be as simple as:

$mainNodeID = $object->attribute( 'main_node_id' );

But I guess you have tried that, and $mainNodeID is still empty? What about $object? Are you sure it is defined?

Roy

Eirik Alfstad Johansen

Thursday 29 January 2004 1:07:36 am

Hi Roy,

Actually, I hadn't, and it worked. For debugging purposes, I was using the PHP function get_object_vars() which showed the MainNodeID as emtpy, but accessing it using the attribute method worked like a charm.

Thanks !

Sincerely,

Eirik Johansen

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

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