We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 41149
    • 43 Posts
    Hello,

    To sum up what I need to do, I need to get the Parent ID of the current Document and output it into WayFinder as the Starting ID.

    My WayFinder Call (Within Chunk):
    [[!Wayfinder? &displayStart=`TRUE` &startId=`[[!getParent]]` ]]


    My getParent Snippet:
    <?php
    $id = $resource->get('parent');
    return $id;


    My Resource Structure:
    Parent
    - Child
    - Child
    Parent
    - Parent
    -- Child
    -- Child
    -- Child

    I am applying this to the Parent -> Parent -> Child Resources.

    I need this because I have to use this WayFinder call through multiple Resources on multiple Contexts. So I cannot specify each individual startID in each individual Chunk or Resource.

    Thank you! [ed. note: last edited this post 14 years, 3 months ago.]
      The web is our sandbox, so let's develop a castle.
      • 4172
      • 5,888 Posts
      you would need:

      <?php
      $id = $modx->resource->get('parent');
      return $id;


      but, you don't need a snippet for that at all.
      You can do

      [[!Wayfinder? &displayStart=`TRUE` &startId=`[[*parent]]` ]]


      If you allways need the ultimateParent of the top level or any other level you can use the ultimateParent - snippet

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

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!