We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7575
    • 85 Posts
    Hi

    I want to write a snippet in revloution that shows all the titles of the parents of the current document.
    I found getChildsIds in the forums and with a bit common sense I got
    <?php
    $parent=$modx->documentObject['parent'];
    $parentsparent=$modx->getParentIds($parent,1);
    $parentarray = $modx->getChildIds($parentsparent[0], 1);
    print_r ($parentarray);
    ?>

    now I need to get the titles of all those documents...

    I know there is an API where tons of functions are to be found.
    But how the *** do I search in there?
    it’s so big and I have no idea where to look?

    and I have trouble understanding what the searchbox on http://api.modxcms.com/ actually does.

    Can someone teach me how to find functions in the api ?
    So I won’t have to ask the forums every time I need a function?
      www.tornooi.net online database for (sport) events in dutch.
      To be redesigned, rewritten to modx with multiple languages...
      ANY help appreciated, I cannot offer money but I can offer free advertising on the site. just message me.
      • 3749
      • 24,544 Posts
      The documentation is automatically generated from comments in the code and it takes a little getting used to (I can’t get the search function to work either).

      To see some of the API methods, expand:

      modx->Classes->DBAPI
      modx->Classes->modResource, modelement, etc.
      xpdo->Classes->xPDO

      Scroll down in the right panel and click on the method you want to know more about.

      See also: http://bobsguides.com/revolution-objects.html

      FYI: The documentObject array is deprecated in Revolution. Use this instead:

      $modx->resource->get('fieldname');


        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
        • 28215
        • 4,149 Posts
        I assume you only want the direct parent; try this:

        $parent = $modx->resource->getOne('Parent');
        return $parent ? $parent->get('pagetitle') : '';
        

          shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
          • 7575
          • 85 Posts
          tnx a lot bobray that link is exactly what I needed to really get started...!
            www.tornooi.net online database for (sport) events in dutch.
            To be redesigned, rewritten to modx with multiple languages...
            ANY help appreciated, I cannot offer money but I can offer free advertising on the site. just message me.