children id list

Author Message

Aladdin Mouhaimeed

Tuesday 13 September 2005 7:58:06 am

How can I have a list of IDs of the node's children in PHP (not in template language)????
I know this will be so simple, but I tried hard.

Aladdin Mouhaimeed

Tuesday 13 September 2005 9:53:03 am

Hi :
i have used this code for doing that:

$var = call_user_func_array( array( new eZContentFunctionCollection(), 'fetchObjectTree' ),
array('parent_node_id' => 59,
'only_translated' => false,
'language' => false,
'offset' => false,
'limit' => false,
'depth' => 100,
'depth_operator' => "le",
'class_id' => false,
'attribute_filter' => false,
'extended_attribute_filter' => false,
'class_filter_type' => false,
'class_filter_array' => false,
'group_by' => false,
'main_node_only' => false,
'ignore_visibility' => false,
'limitation' => null,
'as_object' => null ) );
$var = isset( $var['result'] ) ? $var['result'] : null;
echo $var;
while ( is_object( $var ) and method_exists( $var, 'templateValue' ) );
$v= $var[1];
echo $v->attribute('node_id');

and that makes us getting the ids of children nodes, so is it good way?or there is cleaner one?

Aladdin Mouhaimeed

Tuesday 13 September 2005 11:21:46 am

Well Aladdin, you ask for help, I'm here to help.

use this code from http://ez.no/community/forum/developer/moving_objects_via_php_cron/re_moving_objects_via_php_cron__23

        $existingNode = $object->attribute( 'main_node' );
		$folder_node_id = $existingNode->attribute( 'node_id' );
	    $childNodes =& eZContentObjectTreeNode::subTree( $params, $folder_node_id );
    foreach( $childNodes as $child )
    {
        $thisNode = $child -> MainNodeID;
        $userID = $child -> ContentObjectID;
echo $thisNode;
       // Fetch the user object
       $object =& eZContentObject::fetch( $userID );

  }

Bertrand Dunogier

Tuesday 13 September 2005 12:32:03 pm

$node =& eZContentObjectTreeNode::fetch($nodeID);
$children =& $node->children();
foreach ( array_keys( $children ) as $key )
{
  $ids[] = $children[$key]->NodeID;
}

There you are.

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

eZ debug

Timing: Jan 18 2025 19:29:49
Script start
Timing: Jan 18 2025 19:29:49
Module start 'layout'
Timing: Jan 18 2025 19:29:49
Module start 'content'
Timing: Jan 18 2025 19:29:50
Module end 'content'
Timing: Jan 18 2025 19:29:50
Script end

Main resources:

Total runtime0.8209 sec
Peak memory usage4,096.0000 KB
Database Queries60

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00020.0056 587.7969152.6094
Module start 'layout' 0.00580.0035 740.406339.4141
Module start 'content' 0.00930.8101 779.8203482.5547
Module end 'content' 0.81930.0015 1,262.375012.1875
Script end 0.8209  1,274.5625 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.3842160.0002
Check MTime0.00140.1719160.0001
Mysql Total
Database connection0.00080.096110.0008
Mysqli_queries0.766293.3363600.0128
Looping result0.00060.0786580.0000
Template Total0.784695.620.3923
Template load0.00220.268520.0011
Template processing0.782395.303120.3912
Template load and register function0.00020.024510.0002
states
state_id_array0.00100.118610.0010
state_identifier_array0.00130.154220.0006
Override
Cache load0.00190.2302390.0000
Sytem overhead
Fetch class attribute can translate value0.00090.112020.0005
Fetch class attribute name0.00200.239740.0005
XML
Image XML parsing0.00020.030420.0001
class_abstraction
Instantiating content class attribute0.00000.001140.0000
General
dbfile0.00080.0917100.0001
String conversion0.00000.001040.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 16
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs