Forums / Developer / php script problem / Comment47218

Author Topic

Aurore Hublé

Thursday 26 October 2006 2:05:06 am

Comment47218

Thanks for your answer.

The default siteaccess is the same I use.

The script :

<?php
	include_once( 'lib/ezutils/classes/ezcli.php' );
	include_once( 'kernel/classes/ezscript.php' );
	
	$cli =& eZCLI::instance();
	$script =& eZScript::instance( array( '',
	                                      'use-session' => false,
	                                      'use-modules' => true,
	                                      'use-extensions' => true,
					      'user' => true ) );
	$script->startup();
	$scriptOptions = $script->getOptions( '','', false, false, array( 'user' => true ) );
	$script->initialize();
	
	if ( ! $script->isInitialized() )
	{
		echo("Erreur : Impossible d'initialiser le script.");
		$script->shutdown();
		exit ();
	}
	include_once("kernel/classes/ezcontentobjecttreenode.php");
	$params = array( 'ClassFilterType' => 'include', 
					 'ClassFilterArray' => array(17,18)
			     );
	
	$objects =& eZContentObjectTreeNode::subTree( $false, 69 );
	echo(count($objects));
	foreach ( $objects as $child){
		echo($child->attribute('name'). " | " $child->attribute('class_identifier'). "\n");	
	}
?>

Launch with :
/opt/php/bin/php script.php -l admin -p pwdadmin

Result : "20
pro-distributeur | folder
Spare parts | rubrique
....
Autre | rubrique
Bloc gauche | bloc"

And if I launch the same fetch in extension or template, I have all nodes.

(print_r give the same result)