We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 11455
    • 6 Posts
    May be someone here has an idea for my need.

    I have resources with a number of different TVs. One TV for example is a radio button with five values.

    What I want to do is to display the resources in groups (TVs) with getResources on a page. One need for example is to group the values of the radio button TV and display them in an accordion with the radio button value as header which shows all resources according to this value.

    The different TVs in the resources are needed to categorize them for example by place, by topic, by facilitator, etc. and show the results on different pages.

    Thanks a lot for any help, Gudrun
      • 19369
      • 1,098 Posts
      Have you tried with &tvFilters parameter plus &includeTVs, &processTVs and &sortbyTV ?
        • 11455
        • 6 Posts
        Yes, I did. All of the parameters. But I need not to filter them. I want to show all the resources but they should be grouped by the values of the TV radio button.
          • 19369
          • 1,098 Posts
          What is exactly that does not work? Can you give us an example of your code? It is difficult to help you without that.
            • 11455
            • 6 Posts
            Thank you for thinking about it. I didn't think that it didn't work - just wondering how to group the different categories.

            Here is an example

            Context
            Folder (ID7)
            - Resource (ID99)
            - Resource (ID97)
            - Resource (ID96)
            - Resource (ID95)
            - Resource (ID94)
            - Resource (ID93)
            - Resource (ID89)
            - etc.

            The resources have the same template wich additional TVs like

            Venue (Radio Button TV)
            - Rom
            - Paris
            - Budapest
            - Lissabon
            - Madrid
            - etc.

            Topic (Radio Button TV)
            - Art
            - Music
            - TV
            - Movie

            Facilitator (Text TV)

            Date (Date TV)


            ---------------

            [getResources? &parents=`7` &limit=`9999` &includeContent=`1` &includeTVs=`1` &processTVs=`1` &tpl=`group` ]]

            ---------------

            On the page I'd like to offer the visitors different views - within an accordion

            Simple version - one level

            VENUE

            Rom (header accordion, clickable)
            - resource 93 (result, slide)
            - resource 97 (result, slide)
            - resource 99(result, slide)
            Paris (header, accordion, clickable)
            - resource 95 (result, slide)
            - resource 99 (result, slide)
            - etc.

            Extended version - multiple levels

            TOPIC

            Art (header, accordion level 1, clickable)
            - Rom (header, accordion level 2, clickable)
            - resource...(result, slide)
            - resource ...(result, slide)
            - Paris (header, accordion level 2, clickable)
            - resource (result, slide)
            - resource (result, slide)
            - etc.
            Movie ((header, accordion level 1, clickable)
            - Rom (header, accordion level 2, clickable)
            - resource...(result, slide)
            - resource ...(result, slide)
            - Paris (header, accordion level 2, clickable)
            - resource (result, slide)
            - resource (result, slide)
            - etc.

            Hope, it's a bit more clear now.
              • 19369
              • 1,098 Posts
              I think you may do that with &tvFilters=`` and &sortbyTV parameter , see the example below.

              Basically I used: &tvFilters=`venue!=` which, in plain english means: If venue template variabile is NOT empty, then output the document, also, order them by venue name (with &sortbyTV).

              [[getResources?
                &parents=`7`
                &tpl=`group`
                &limit=`9999` 
                &tvFilters=`venue!=`
                &includeTVs=`1`
                &processTVs=`1`
                &tvPrefix=``
                &sortbyTV=`venue`
                &sortdirTV=`ASC`
                ]]
              
              [[getResources?
                &parents=`7`
                &tpl=`group`
                &limit=`9999` 
                &tvFilters=`topic!=`
                &includeTVs=`1`
                &processTVs=`1`
                &tvPrefix=``
                &sortbyTV=`topic`
                &sortdirTV=`ASC`
                ]]
                • 11455
                • 6 Posts
                That sounds good. Thank you very much for sharing and the explantations. Didn't know that thing with the exclamation mark yet. Will try it tomorrow and let you know, if I could manage it to work.
                  • 19369
                  • 1,098 Posts
                  That's a filter, further details in the documentation, here (see tvFilters):
                  http://rtfm.modx.com/display/ADDON/getResources#getResources-SelectionProperties

                  I think that they're standard php operators, you can see a better explanation on w3schools website:
                  http://www.w3schools.com/php/php_operators.asp [ed. note: microcipcip last edited this post 14 years, 8 months ago.]
                    • 37763
                    • 12 Posts
                    Try to Re-call getresources in your getresources tpl.
                    Example:
                    [ed. note: imamwbs last edited this post 14 years, 6 months ago.]