Monday 03 August 2009 1:59:14 am
Thank you Gaetano. I'm sorry it's still not working, I'm not getting shown the new content on the site, not when I use the API to refresh the cache and not when I do that manually. The odd thing is that it does work, but only for one single site out of 15 I've been testing this on. That one is the one I originally programmed it for. Have been searching for anything that would make it specific to that site, but the script seems to be general. If it's of any help, I'm posting my source code below I'm using to try and refresh the frontpage content.
Best wishes, Rainer
$node =& eZContentObjectTreeNode::fetch( $homepage_id );
$myContentObjectAttributes =& $node->attribute('data_map');
$title = $myContentObjectAttributes['page'];
$title2 = $title->attribute( 'data_text' );
$new_object = eZPage::createFromXML($title2);
$zones = $new_object->attribute( 'zones' );
$blocks =& $zones[0]->attribute( 'blocks' );
$keys = array_keys($blocks[0]->attribute( 'valid' ));
$block_0 = $blocks[0]->attribute( 'valid' );
$key_1 = $keys[0];
$node_ID = $block_0[$key_1]->attribute( 'object_id' );
$blocks[0]->toBeModified();
$blocks[1]->toBeModified();
$n_o = $new_object->toXML();
$title->setAttribute("data_text", $n_o );
$title->store();
print_R($n_o);
$NodeID = $node->NodeID;
$parentContentObject =& $node->attribute( 'object' );
$operationResult = eZOperationHandler::execute( 'content', 'publish',
array(
'object_id' => $parentContentObject->attribute( 'id' ),
'version' => $parentContentObject->attribute('current_version' ) ) );
print_r($operationResult);
eZContentCacheManager::clearContentCache( $parentContentObject->attribute('id') );
|