We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20407
    • 82 Posts
    Maybe I’m missing something, but I just spent an hour trying to determine how to get TVs to show in a getResources chunk. So if my TV is called "example" I thought the syntax would be [[*example]], but with getResources you use [[+tv.example]], and you also have to add &includeTVs=`1` &processTVs=`1` in the snippet call. This doesn’t make sense to me and it’s not documented adequately, so maybe this post will help someone else.
      • 25141
      • 49 Posts
      check! just helped me ... thanks.
        • 33987 ☆ A M B ☆
        • 197 Posts
        It is documented here: http://rtfm.modx.com/display/ADDON/getResources

        And it does make sense. Checking for TV’s makes the whole thing slower. So if you don’t need TV’s in a resource listing you can omit the includeTV value and your getResource call will generate faster.

        processTV isn’t always needed by the way.
          Sterc Internet & Marketing | MODX Founding Partner | Chairman of the MODX Advisory Board

          In need of a MODX consult? Try our MODX Developers Experts!
          • 12508
          • 63 Posts
          I’m glad I found this topic here. It solved my problem. I spent many hours trying to understand why [[*example]] does not work but [[+tv.example]]. Sadly is not well documented on http://rtfm.modx.com/display/ADDON/getResources.
            • 20407
            • 82 Posts
            Nomark, I didn’t say it wasn’t documented, just that it wasn’t documented adequately. I can’t see where it says you use a plus sign instead of an asterisk -- I found that by trial and error. The part that doesn’t make sense is why the syntax is different, not that there is an option to include or not include TVs.
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              The + sign is for placeholders. A placeholder is a value generated by the snippet involved, since the snippet is processing each resource and needs to insert the required values for each resource into the tpl as it loops through the list of resources.

              The * is for TVs (and resource values like pagetitle) for the current resource - in this case, the resource with the getResources (or Ditto) call; it is inserted by the MODx parser itself.

              If you were to use * in the getResources tpl, it would use the value for the current resource that MODx is parsing (the one with the getResources call on it), and not the individual values for the resources getResources is looping through.

              So if you have resource #43 with the getResources call on it, * will always refer to the value associated with resource #43. If the getResources snippet is dealing with resources #56-#59, then + will refer to the value for each of those resources in turn as getResources loops through them.
                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
                • 20407
                • 82 Posts
                Thank you for the explanation Susan! cool
                  • 24383
                  • 12 Posts
                  Same for me. I could get it to work, until I found this page.
                  Maybe somebody can put Suzan’s post in the documentation. I think it would make sense to a lot of users.

                  Regards
                    • 3749
                    • 24,544 Posts
                    Quote from: Rainman51 at Nov 12, 2010, 05:12 AM

                    Same for me. I could get it to work, until I found this page.
                    Maybe somebody can put Susan’s post in the documentation. I think it would make sense to a lot of users.

                    Regards

                    Done.
                      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
                      • 28042 ☆ A M B ☆
                      • 24,524 Posts
                      I should start keeping track of how many times I post that explanation of the difference between [*...*] and [+...+] in Ditto or other similar snippets! Of course, I had to get bitten by it once or twice myself before I finally caught on rolleyes
                        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