Forums / Developer / I need to develop a cronjob

I need to develop a cronjob

Author Message

Jorge estévez

Thursday 25 February 2010 5:22:32 pm

Hello

 

I need to develop a cronjob that will go through all certain nodes and get all attributes of its class, what should I use to “get” the attributes so I can display them? Is there a similar cronjob that get’s attributes starting from a tree node?

 

Thanks

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

Gaetano Giunta

Friday 26 February 2010 6:54:38 am

To walk the content tree, look at eg. how the ezfind indexation cronjob does it.

To fetch the attributes of a node or object, here's eZP little dirty trick: the "attribute" function.

Every object you read in the eZ manual at http://ez.no/doc/ez_publish/technical_manual/4_x/reference/objects is in php terms a subclass of ezpersistentobject.

And all the object attributes available in templates via "." and documented in the docs are available in php code via the "attribute" function.

So if $node is an ezcontentobjecttreenode, $node->attribute( 'data_map' ) will return an array with all the attributes of the encapsulated object. $node->attribute( 'children' ) will return an array with all the children nodes and so on...

Principal Consultant International Business
Member of the Community Project Board

Jorge estévez

Monday 01 March 2010 6:55:56 am

Hello,

Thanks... I have walked the tree, I now have access to all nodes (quite fast)... I am triying to access each attribute (I need to display "attribute name" and its "valus", but even with the help of friends this weekend we did not manage to do nothing:

Can you give me a hand?

This is the code:

<code>

//this works fine, it displays all the nodes

$cli->output( 'node found: "' . $node->attribute( 'name' ) . '" (' . $node->attribute( 'node_id' ) . ')' );

$mynodeArray = $node->attribute( 'data_map' );
$mycounter = -1;

////// I need to go trough all the attributes and display them (name and value)


foreach ( $mynodeArray as $myattr )
{
$mycounter += 1;

//var_dump( $myattr );

}

</code>

Please look at the commented lines in the code.

Another question: an you point out what to use to save the values to a file?

Thanks

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com