This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » Developer » How to create folder in root "directory"
expandshrink

How to create folder in root "directory"

How to create folder in root "directory"

Thursday 17 April 2003 3:33:59 pm - 3 replies

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

Thank you vrey much

Tuesday 22 April 2003 11:03:40 am

I've tried:

$nove =& eZContentObject::create( "new_folder", 1, 14);
$nove->store();
$nove->setName("new_Folder"blunk.gif Emoticon;
$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

Wednesday 23 April 2003 10: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' ) );

Thursday 24 April 2003 4:47:29 pm

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

expandshrink

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

36 542 Users on board!

Forums menu

Proudly Developed with from