We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 39201
    • 10 Posts
    Many apologies if this has been kicked to death in another thread somewhere else...couldn't find one.

    What I'm trying to do:

    - The site I'm working on (in MODX Evo) has one big resource tree with all the content and one small tree of hard categories.

    - I'm using ddTree to turn the category tree into a TV drop-down list of categories.

    - If you just put in a placeholder for the TV in a given document, the output is the document ID of the category page, not the title (as it appears in the drop-down list itself) - so that's fairly useless for site navigation!

    - So I hit on the idea of doing a ditto call to get the page title visible. so far it's this: [[Ditto? &parents=`[+Category1+]` &total=`1` &tpl=`tplTitle`]] (Category1 is the category list, tplTitle just contains a [+pagetitle+] placeholder). The problem I'm having is that, rather than getting the title of the target category page, or indeed the title of the current page, this call gets the title of whatever happens to be the last document you've created.

    After much head scratching, I have been unable to sort this out. I was wondering if anyone with more than a week's experience as a web designer (god help me) has more of a clue as to how I can make this relatively simple thing happen.
      • 19369
      • 1,098 Posts
      I don't understand very well what you are doing, but I think that you are looking for getField snippet. getField is a snippet that is able to "get" any template variable from a resource of your choice. It is very useful.

      Example:
      [[getField? &docid=`[+parent+]` &field=`pagetitle`]]
        • 39201
        • 10 Posts
        I don't understand it terribly well either smiley Didn't work (I need some way to get the output from a TV *inside* a snippet parameter), but thanks anyway.

        Might have to rip the whole thing up and find another, more sensible way to do this.
          • 19369
          • 1,098 Posts
          I think I get it now. Install getField and try with this code:
          [[getField? &docid=`[+Category1+]` &field=`pagetitle`]]
            • 39201
            • 10 Posts
            Worked when I changed the + into a *. Cheers
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              In a Ditto template, [*...*] tags will always return the value for the actual page the Ditto snippet call is on. The [+...+] tags will return the value for the resource that is being processed as part of Ditto's list.
                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
                • 39201
                • 10 Posts
                I honestly tried every combination, and got nothing...oh well, crisis over!