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

    I'm on MODx Revo 2.2 and I'm sure I've done this before, but I can't for the life of me figure out how to do it again!

    I have a resource tree as follows:

    Top Level
    -- Sub Level
    ---- Sub-Sub Level

    On the 'sub-sub level' page, I just need to pull in the title of the 'sub level' page. No links, nothing fancy, just the same of the page for text purposes.

    Does anyone know how I can achieve this? All the modules I keep finding seem to just pull in the ID of the resource and not the page title.

    Kind regards,
    Lewis
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Use the getResourceField snippet:
      [[getResourceField? &id=`[[*parent]]`]]

      By default it returns the pagetitle; use the &field property to get a different field value.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 37105
        • 194 Posts
        Would this be an option?

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


        Ah, Susan was already giving the correct answer smiley
          Codeplaza Webdesign: for professional websites at low cost
          • 17035
          • 36 Posts
          Works like a charm!

          Thank you!!!
            • 8274 ☆ A M B ☆
            • 222 Posts
            I believe you can also do something like this to load the parent page as an object

            $resource =& $modx->resource; //load the current resource
            $parent = $resource->getOne('Parent');//load the resource's parent
            $parentTitle = $parent->get('pagetitle');//retrieves the parent object's page title field
            


            Jason