Thursday 01 June 2006 2:51:58 am
I searched over a forum and I cannot find answer for my problem. I `m writting template operator for a counter. For that purpose I`ve created one class with few integer attributes in it (counter1, counter2...). Passed parameteres are nodeid and attributeid. This operator works, but I can`t acctualy see counter`s incremeted value until I click on clear cache button to refresh content. So, my question is how to publish content from a template operator? Experienced users, please help... Code follows:
$anode =& eZContentObjectTreeNode::fetch( $nodeid );
if ( !$anode )
{
eZDebugSetting::writeDebug( 'kernel-notification',
'Newsletter module: No node with ID: ' . $nodeid );
return;
}
$anodeObject =& $anode->object();
$attributes =& $anodeObject->contentObjectAttributes();
$atvalue = $attributes[$attributeid]->content();
$atvalue = $atvalue + 1;
$attributes[$attributeid]->setAttribute( "data_int", $atvalue ); $attributes[$attributeid]->store();
/* store object */
$anodeObject->store();
// this should publish the new version ??? $operationResult = eZOperationHandler::execute( 'content', 'publish', array( 'object_id' => $anodeObject->attribute( 'id' ), 'version' => $anodeObject->attribute('current_version') ) );
|