Hi,
like to change the content of a resource programatically. Is there a "setResourceField" ?
What is the best way?
Thx!
[ed. note: johnjohn22 last edited this post 14 years, 4 months ago.]
____________________________________________________
if ($resource = $modx->getObject('modResource',$resid)){
$resource->setContent('new Content');
if ($resource->save()){
$output = 'Resource '.$resource->get('pagetitle').' saved';
}
else{
$output = 'There was an error saving Resource '.$resource->get('pagetitle');
}
}
else{
$output = 'Resource '.$resid.'not found';
}
return $output;
Thanks Bruno17, works like a charm!
____________________________________________________