We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22656
    • 121 Posts
    what is generaly considered fastest and most future proof way of getting the parent id of a document in a snippet? i've had a looksie through the forums but theres so many ways im kinda lost now.

      • 4172
      • 5,888 Posts
      to get the parent of the actual resource in a snippet on Revo use:

      $parentID = $modx->resource->get('parent');

        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 22656
        • 121 Posts
        Thanks!
        just to expand on this, to get an array of all parents for any given resource in a snippet, use this:

        $id = isset($id) ? $id : $modx->resource->get('id');
        $pids = $modx->getParentIds($id, 100);