Forums / Developer / what am I doing wrong?

what am I doing wrong?

Author Message

Tomek Klaudel

Monday 12 July 2004 3:26:45 am

    $node =& eZContentObjectTreeNode::fetch( $target );
    $subTree =& $node->subTree( array ( 'Depth' => 1 ) );

from second line i got :
<i>Call to a member function on a non-object</i>

Paul Borgermans

Monday 12 July 2004 12:46:40 pm

Hard to tell, we need the lines before that too ($node is obviously not set)

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Tomek Klaudel

Monday 12 July 2004 2:04:33 pm

thanks for reply, here is rest of code:

<?
include_once( 'lib/ezsoap/classes/ezsoapserver.php' );
include_once( 'kernel/classes/ezcontentobjecttreenode.php' );

$server = new eZSOAPServer();
$server->registerFunction( "getContent", array ("arg0" => "string") );
$server->processRequest();

 function getContent( $target )
 {
     $node =& eZContentObjectTreeNode::fetch( $target );
     $subTree =& $node->subTree( array ( 'Depth' => 1 ) );
     $entries = array();
     foreach ( $subTree as $someNode )     {
         $entries[] = getNodeInfo( $someNode );
     }
     $thisNodeInfo = array ();
     $thisNodeInfo = getNodeInfo( $node );
     $thisNodeInfo["href"] = $_SERVER['SCRIPT_URI'];
     $entries[] = $thisNodeInfo;
  	 return $entries;
}
?>

I need something else to include? Or something to delete...
I'm calling this method with taget variable set to 2 (root node).

Kåre Køhler Høvik

Tuesday 13 July 2004 12:19:10 am

Hi

What to check :
- What value does the parameter $target have ?
- Where is getNodeInfo defined ?

--
Kåre Høvik

Kåre Høvik

Tomek Klaudel

Tuesday 13 July 2004 12:42:01 am

- What value does the parameter $target have ?

2

- Where is getNodeInfo defined ?

to simplify question I commented lines :

//     foreach ( $subTree as $someNode )     {
         //$entries[] = getNodeInfo( $someNode );
//     }
     //$thisNodeInfo = array ();
     //$thisNodeInfo = getNodeInfo( $node );
     //$thisNodeInfo["href"] = $_SERVER['SCRIPT_URI'];
     //$entries[] = $thisNodeInfo;

and I got again "Call to a member function on a non-object".
Propably I didn't initialized some variables, but I dont know what I need to initialize...
In docs i don't found anything on this, also in the book.

Tomek Klaudel

Wednesday 14 July 2004 9:11:51 am

Ok, I found that this is becouuse I not set sitedesign/siteaccess.
So maybe someone know what is the proper way to do it?

Greetings
Tomek