Code for create new resource in Modx Revo :
$class = 'modResource';
$resource= $modx->newObject($class);
$resource->set('context_key', 'web');
$resource->set('content_type', 1);
$resource->set('pagetitle', PAGE_TITLE); // here you enter your new resource pagetitle
$resource->set('parent', PARENT_ID); // here you enter parent id in which you want to see you new resource
$resource->set('isfolder', false);
$resource->set('published', true);
$resource->set('template', TEMPLATE_ID); // set template id
$resource->set('pub_date', strftime('%Y-%m-%d %H:%M:%S',strtotime(PUBLISH_DATE))); // set publish date
$resource->set('searchable', $this->modx->getOption('search_default'));
$resource->set('cacheable', $this->modx->getOption('cache_default'));
$resource->_fields['content']= $res_content; // set resource content in $res_content
$resource->save();
now it will create new reource in your modx. Now,
Code for create new resource in Modx Revo :
$newResourceUpdate = $modx->getObject('modResource',RESOURCE_ID); // set resource id
$newResourceUpdate->set('template',TEMPLATE_ID);
$newResourceUpdate->set('parent',PARENT_ID);
$newResourceUpdate->set('pub_date', strftime('%Y-%m-%d %H:%M:%S',strtotime(PUBLISH_DATE)));
$newResourceUpdate->save();
After this it will update your resource values.
Comment it and ?Share it if it helps you.
$class = 'modResource';
$resource= $modx->newObject($class);
$resource->set('context_key', 'web');
$resource->set('content_type', 1);
$resource->set('pagetitle', PAGE_TITLE); // here you enter your new resource pagetitle
$resource->set('parent', PARENT_ID); // here you enter parent id in which you want to see you new resource
$resource->set('isfolder', false);
$resource->set('published', true);
$resource->set('template', TEMPLATE_ID); // set template id
$resource->set('pub_date', strftime('%Y-%m-%d %H:%M:%S',strtotime(PUBLISH_DATE))); // set publish date
$resource->set('searchable', $this->modx->getOption('search_default'));
$resource->set('cacheable', $this->modx->getOption('cache_default'));
$resource->_fields['content']= $res_content; // set resource content in $res_content
$resource->save();
now it will create new reource in your modx. Now,
Code for create new resource in Modx Revo :
$newResourceUpdate = $modx->getObject('modResource',RESOURCE_ID); // set resource id
$newResourceUpdate->set('template',TEMPLATE_ID);
$newResourceUpdate->set('parent',PARENT_ID);
$newResourceUpdate->set('pub_date', strftime('%Y-%m-%d %H:%M:%S',strtotime(PUBLISH_DATE)));
$newResourceUpdate->save();
After this it will update your resource values.
Comment it and ?Share it if it helps you.