We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 50923
    • 137 Posts
    I am using articles container for some documents, only problem is that i dont know how to create new article via API inside Article container, regular code when creating new article does not work, post is not showing inside container, here is my code for creating simple ModDocuments

     // secondly, create the new resource and save it:
        $doc = $modx->newObject('modDocument');
        $doc->set('parent',$parent);
        $doc->set('pagetitle',$pagetitle);
        $doc->set('longtitle',$longtitle);
        $doc->set('alias',$alias);
        $doc->set('description',$description);
        $doc->set('template',$template);
        $doc->set('published',$published);
    	$doc->set('searchable',$searchable);	
        $doc->setContent($content);
        $doc->save();
      <a href="www.play2web.com" title="izrada web sajtova">Izrada web sajtova</a>
      • 52064
      • 120 Posts
      I've also had the same problem.
      I solved it by creating an unpublished article that I use as a template based,
      controls in the table the contents of the various fields, article uses a different type of resource.
        FerX - Developer at Eracom s.r.l.
        • 42562
        • 1,145 Posts
        Sir, Articles Extra, I believe, extends Resource Object.

        Different class_key
        $doc->set('class_key','Article');
          TinymceWrapper: Complete back/frontend content solution.
          Harden your MODX site by passwording your three main folders: core, manager, connectors and renaming your assets (thank me later!)
          5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
          • 3749
          • 24,544 Posts
          +1 for donshakespeare's solution. smiley
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting