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

    How does one get the resource parent menutitle? [[*parent]] renders the resource’s parent ID but I need to render the menutitle - what syntax should be used?


    Thanks

    dubbs
      • 3749
      • 24,544 Posts
      You could use the getField snippet, but here’s a custom snippet that should work:

      create a snippet called getMenuTitle:

      <?php
      $resource = $modx->getObject('modResource', $id);
      return $resource->get('menutitle');
      ?>


      Then use this where you want the menutitle:

      [[!getMenuTitle? &id=`[[*parent]]`]]



        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
        • 8168
        • 1,118 Posts
        Thanks Bob, that looks like a great way of doing it! I managed to also get it to work using getResourcesField, code sample below for those who are looking to do this:

        [[getResourceField? &id=`[[*parent]]`]]


        cheers,

        dubbs.