Saturday 06 March 2010 5:46:07 am
Hello, really need help with this.... Having some problems here: Again I am in an ez 3.10.0 version I have been able to go trough all the nodes (for my defined classes) and also display its attributes (only if they are 'ezstring'), but php crashes when I get 1500 nodes... The error: PHP Script Interpreter ha detectado un problema y debe cerrarse. (traslating: PHP script interpreter has detected a problem and must shut down) The ini file contains:
[datosparalistarproductos]
RootNodeList[]=177
laclase[modelo_de_producto]=name laclase[una_pieza_gastronomico]=name the code (commented): <code>
<?php
// get values from content.ini
$ini = eZINI::instance( 'content.ini' );
// get starting node (begining from this node)
$rootNodeIDList = $ini->variable( 'datosparalistarproductos','RootNodeList' );
// get classes that I need
$clasesquequierobuscar = $ini->variable( 'datosparalistarproductos', 'laclase' );
$offset = 0;
$limit = 100;
// all the tree
foreach( $rootNodeIDList as $nodeID )
{
// get the root node
$rootNode = eZContentObjectTreeNode::fetch( $nodeID );
// for every class defined in the .ini
///
foreach ( $clasesquequierobuscar as $laclasequeletoca => $attributeIdentifier )
{
$offset = 0;
$counter = 0;
// objects must...
$params = array( 'ClassFilterType' => 'include',
'ClassFilterArray' => array( $laclasequeletoca ),
'Limitation' => array(),
'IgnoreVisibility' => true,
'MainNodeOnly' => true
);
//get subtree
$nodeArrayCount = $rootNode->subTreeCount( $params );
// if exists
if ( $nodeArrayCount > 0 )
{
do
{
$params['LoadDataMap'] = false;
$params['Limit'] = $limit;
$params['Offset'] = $offset;
//$params['SortBy'] = array( array( 'published', true ) );
$params['MainNodeOnly'] = true;
// ofset will be increased at the bottom for each loop
// limit will have the number of nodes to be looped (increased at the bottom)
echo("\n\n---------------offset: "); echo($offset);echo("\n");
$nodeArray = $rootNode->subTree($params);
// get all attributed of type 'ezstring'
// all attributes end with a ";" as the output will be imported in an excel file (separated by ";")
// if the attribute is empty then echo ";" as "empty value"
// for each node of the array
foreach ( $nodeArray as $node )
{
// get data_map
$arreglo_de_attributos = $node->attribute( 'data_map' );
// for each data_map array
foreach ($arreglo_de_attributos as $atributo) {
// if the attribute is 'ezstring'
if ($atributo->attribute( 'data_type_string' )=='ezstring')
{
// if it has NO echo a ";"
if($atributo->attribute( 'data_text' )=='') // null
{
echo ";";
}
else{
// if it has a value, trim \r \n and \0
$cadena=trim($atributo->attribute( 'data_text' ),"\r\n\0");
echo($cadena);
echo ";";
}
}
}
// a new line for the next node to be analized
echo "\n";
}
// update counter for the While loop
$counter += $limit;
// update offset to fetch the next bunch of nodes
$offset+=$limit;
} while( $counter < $nodeArrayCount and is_array( $nodeArray ) and count( $nodeArray ) > 0 );
}
}
} ?> </code> Really need help with this.... thanks
Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com
|