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

    Im having problems trying to get this resource to work, i dont know if this is the correct way to do this. but I would like to generate a menu list from a list of given page ID's. What I have so far is:

    [[!pdoResources? &includeTVs=`title,id` &tpl=`get-glossary-row` &parents=`24,25,26,27,28`]]

    my chunk contains:

    <li>
    <a href="[[++site_url]][[~[[+id]]]]">
    [[+tv.title]]
    </a>
    </li>

    is this the correct way, am i doing something wrong?
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Do you actually have Template Variables named "title" and "id"?

      If you mean the resources' pagetitle and id, those are simply accessed with [[+pagetitle]] and [[+id]], and no property &includeTVs. That's only necessary if you want to use Template Variables besides the regular resource fields.

        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
        • 47401
        • 295 Posts
        Hi

        Thanks for your response, yes I do have a TV called Title. the problem im finding is that i cant get it to show the specificed pages. the parent page is the (web) home page, I have specific documents I want to show in the menu. these documents are only 1 level from the home page and do not contain any child pages.
          • 13428 ☆ A M B ☆
          • 1,031 Posts
          If I understand your problem right, you have to use something like this:
          [[!pdoResources? &includeTVs=`title,id` &tpl=`get-glossary-row` &parents=`-1` &resources=`24,25,26,27,28`]]


          In your call you specified the parents and in your second answer you wrote about specific documents …

          You could also look into the Collections package. With a 'Selections' resource of that package your customers could specify the resource list on their own.
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            The &parents property tells it what resources to use as parents, it will try to display the children of those resources. So if your parent is #1, the &parents=`1` would get all of its children. As Jako says, if you are going to specify what resources you want in the list, then set &parents=`-1` to tell it to ignore that property and just list the ones you have in &resources.
              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