How to create folder in root "directory"

Author Message

Petr Mrzena

Thursday 17 April 2003 6:33:59 am

Could anybody send me code sample which create a new folder in root directory of content (in "My Folder")?

Thank you vrey much

Petr Mrzena

Tuesday 22 April 2003 2:03:40 am

I've tried:

$nove =& eZContentObject::create( "new_folder", 1, 14);
$nove->store();
$nove->setName("new_Folder");
$nove->store();
$node =& eZContentObjectTreeNode::fetch( 2 );
$parentContentObject =& $node->attribute( 'object' );
$sectionID = $parentContentObject->attribute( 'section_id' );
$insertednode =& $node->addChild($parentContentObject->attribute('id'), 2, true);
$nove->store();
$insertednode->store();

but it doesn't work.

Please help

Sergiy Pushchin

Wednesday 23 April 2003 1:07:34 am

Try to look at this code:

$class =& eZContentClass::fetch( 6 );
// Create object by user 14 in section 1
$contentObject =& $class->instantiate( 14, 1 );
$nodeAssignment =& eZNodeAssignment::create( array(
'contentobject_id' => $contentObject->attribute( 'id' ),
'contentobject_version' => $contentObject->attribute( 'current_version' ),
'parent_node' => 16,
'is_main' => 1
)
);

$version =& $contentObject->version( 1 );
$contentObjectAttributes =& $version->contentObjectAttributes();

$contentObjectAttributes[0]->setAttribute( 'data_text', $klubb );
$contentObjectAttributes[0]->store();

$contentObjectAttributes[1]->setAttribute( 'data_text', $distrikt );
$contentObjectAttributes[1]->store();

$version->setAttribute( 'modified', eZDateTime::currentTimeStamp() );
$version->setAttribute( 'status', EZ_VERSION_STATUS_DRAFT );

$version->store();

$nodeAssignment->store();
include_once( 'lib/ezutils/classes/ezoperationhandler.php' );
$operationResult = eZOperationHandler::execute( 'content', 'publish', array( 'object_id' => $contentObject->attribute( 'id' ),
'version' => 1 ) );
$klubbObject =& eZContentObject::fetch( $contentObject->attribute( 'id' ) );

Petr Mrzena

Thursday 24 April 2003 7:47:29 am

Than you wery much for anwer, but I get this error.

Warning: Invalid argument supplied for foreach() in c:\program files\ez systems\ezpublish\lib\ezutils\classes\ezmoduleoperationinfo.php on line 82

I probably missed some initialization, but I didn't find which.
Could you help again?

Than you

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