Forums / Developer / Create a node ?

Create a node ?

Author Message

Bermudez Alban

Tuesday 14 February 2006 3:05:25 am

Hello world,

I want to import file in EzPublish. The file is create but not the node.

the code which create node :

		$newNode =& new ezcontentobjecttreenode();
		$newNode->setAttribute( 'node_id', $contentObject->attribute( 'id' ));
		$newNode->setAttribute( 'parent_node_id', 59);
		$newNode->setAttribute( 'sort_field', 2);
		$newNode->setAttribute( 'sort_order', 0 );
		$newNode->setAttribute( 'contentobject_version', 1 );
		$newNode->setAttribute( 'contentobject_is_published', 1 );
		$newNode->setAttribute( 'main_node_id', $contentObject->attribute( 'id' ));
		$newNode->setAttribute( 'contentobject_id',  $contentObject->attribute('id'));
		$newNode->setName('TestAB');
		$newNode->updateSubTreePath();
		$newNode->store();
		eZContentObjectTreeNode::updateNodeVisibility( $newNode, eZContentObjectTreeNode::fetch(59), false );

The line in the ezcontentobject_tree table is insered but the path_identification_string is wrong and the path_string is null.

And if I change this values with phpMyAdmin, the file does not appear either. How can i do?

Thansk :)