Forums / General / Creating new root node ?

Creating new root node ?

Author Message

H-Works Agency

Monday 28 January 2008 6:32:14 am

Hello,

How is it possible to create a new node, for customs contents, under node_id '1' ?

It would be at the same depth as "Contents, Users, Design...Etc"

Thanx in advance.

EZP is Great

Piotrek Karaś

Tuesday 29 January 2008 11:16:46 am

You actually mean root node or a top level node?

If the latter, I've already done some experiments:
http://ez.ryba.eu/index.php/ez_publish/lab/custom_top_level_nodes_is_that_possible_round_i_exploration
Unfortunately, didn't find time to push it to a more practical dimension ;)
There should be some other works if you look.

If you mean root node, then I might be wrong, but don't think so. The root node has contentobject_id reference equal 0, and there is no contentobject corresponding, which from my experience suggests that root node is purely virtual. It might be called in a fixed way or never called at all, it might be there for tree structuring/recursing only.

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

H-Works Agency

Monday 07 July 2008 5:15:44 am

I was speaking of top-level nodes.

I've read your article and the answer seems to be negative.

For example i have a website with a "reservation" function. Those contents are neither webcontents, or else but uses ezp classes and must thus be inside ezp content tree.

It would be nice if i could have moved all those reservations into a new top-level node and make a custom module accessing them.

EZP is Great

Björn Dieding@xrow.de

Monday 07 July 2008 5:26:28 am

somthing like this will do the job...

<?php
include_once( 'lib/ezutils/classes/ezcli.php' );
include_once( 'kernel/classes/ezscript.php' );
$cli =& eZCLI::instance();
$script =& eZScript::instance( array( 'description' => ( "Content Server Client setup script\n" .
                                                         "creates the incomming node for the content server client\n" .
                                                         "\n" .
                                                         "./extension/contentserver/bin/createincommingnode.php -ssiteaccessname" ),
                                      'use-session' => true,
                                      'use-modules' => true,
                                      'use-extensions' => true ) );

$script->startup();

$options = $script->getOptions( "[admin-user:]",
                                "",
                                array( 'admin-user' => 'Admin user login name' ) );

$script->initialize();

include_once( 'kernel/classes/ezcontentobject.php' );
include_once( 'kernel/classes/ezsection.php' );
// login as admin
include_once( 'kernel/classes/datatypes/ezuser/ezuser.php' );
$user = eZUser::fetchByName( $options['admin-user'] );

if ( is_object( $user ) )
{
	if ( $user->loginCurrent() )
	   $cli->output( "Logged in as 'admin'" );
}
else
{
	$cli->error( 'No admin.' );
    $script->shutdown( 1 );
}
$section = new eZSection( array( 'name' => 'Content server', 'navigation_part_identifier' => 'ezcontentservernavigationpart' ) );
$section->store();
$userClassID = 1;
$userCreatorID = 14;
$defaultSectionID = $section->ID;

$class = eZContentClass::fetch( $userClassID );
$contentObject = $class->instantiate( $userCreatorID, $defaultSectionID );

$remoteID = "contentserver:incomingnode";
$contentObject->setAttribute( 'remote_id', $remoteID );
$contentObject->store();

$contentObjectID = $contentObject->attribute( 'id' );
$userID = $contentObjectID;
$nodeAssignment = eZNodeAssignment::create( array( 'contentobject_id' => $contentObjectID,
'contentobject_version' => 1,
'parent_node' => 1,
'is_main' => 1 ) );
$nodeAssignment->store();
$version =& $contentObject->version( 1 );
$version->setAttribute( 'modified', time() );
$version->setAttribute( 'status', EZ_VERSION_STATUS_DRAFT );
$version->store();

$contentObjectID = $contentObject->attribute( 'id' );
$contentObjectAttributes = $version->contentObjectAttributes();

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

include_once( 'lib/ezutils/classes/ezoperationhandler.php' );
$operationResult = eZOperationHandler::execute( 'content', 'publish', array( 'object_id' => $contentObjectID,
'version' => 1 ) );

$cli->output( "Node created with object_id #$contentObjectID" );

return $script->shutdown();
?>

Looking for a new job? http://www.xrow.com/xrow-GmbH/Jobs
Looking for hosting? http://hostingezpublish.com
-----------------------------------------------------------------------------
GMT +01:00 Hannover, Germany
Web: http://www.xrow.com/

eZ debug

Timing: Jan 18 2025 16:20:55
Script start
Timing: Jan 18 2025 16:20:55
Module start 'content'
Timing: Jan 18 2025 16:20:55
Module end 'content'
Timing: Jan 18 2025 16:20:55
Script end

Main resources:

Total runtime0.1593 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0052 587.6016180.8516
Module start 'content' 0.00520.0045 768.4531101.9453
Module end 'content' 0.00970.1495 870.3984529.8984
Script end 0.1592  1,400.2969 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00352.1868200.0002
Check MTime0.00130.8406200.0001
Mysql Total
Database connection0.00080.480810.0008
Mysqli_queries0.115772.63771410.0008
Looping result0.00130.78821390.0000
Template Total0.149293.610.1492
Template load0.00080.472010.0008
Template processing0.148493.172110.1484
Override
Cache load0.00050.324410.0005
Sytem overhead
Fetch class attribute can translate value0.00090.571810.0009
XML
Image XML parsing0.00040.232910.0004
General
dbfile0.00281.7392200.0001
String conversion0.00000.003130.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0002 secs