We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 44742
    • 15 Posts
    On each page I want to be able to show the title of the directory, which is the nth one down from the top/ultimate directory.

    By doing this, I will be able to show the user which category of content they are currently viewing.

    I'm a newbie, and hopefully this is not too hard to acheive, though I couldn't find the answer on the forum. maybe I am using the wrong terms.

    Steve
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Check the UltimateParent snippet. That has properties to specify the level.
        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
        • 44742
        • 15 Posts
        Hello Sottwell,
        Thanks. Further to your pointer I have tried this but it doe snot seem to return the page title for me.
        [[getResourceField? &id=`[[UltimateParent? &topLevel=`1`]]`]]


        Steve
          • 44742
          • 15 Posts
          Hello again,
          I'm still stuck on this problem and am hoping that someone might be able to tell me where I am going wrong.

          All I can get an output for at the moment is the resouce ID, but I can't seem to get an output for the title of the resource.

          Please help.

          Stevbe
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            Perhaps you need to specify the field you want - &field=`pagetitle`, even though it's supposed to be the default.

            I prefer to use the fastField extra for getting arbitrary fields from arbitrary resources. It provides a new MODx tag, [[#...]]
            [[#[[UltimateParent? &topLevel=`1`]].pagetitle]]

            Since it's actually an extended version of the default MODx parser class, thus making the new tag part of the MODx parser, it's much faster than a snippet. It only works with version of Revo 2.2.7 or above, since that's the first version that has a setting to select the parser to use.
              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
              • 44742
              • 15 Posts
              YES! It worked once I had installed the 'fastfield' plugin.

              Many thanks Sottwell.

              Steve