We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6723
    • 93 Posts
    I've recently started to move sites from Evolution to Revolution. On Evo I used a Ditto call to filter results from a TV using &tagData to specify which TV and then &tags to specify what to filter. The TV had Input Type of Checkbox, with then pre-set Option Values - so it created a neat set of checkboxes to categorize each document.

    Moving to Revolution I've used getPage snippet and it's pulled all documents from a parent and added in some pagination;
    http://www.djcdesign.co.uk/blog/

    Which is great - but I also like a box on right 'Categories' that lists the pre-set option values and links to a landing page that lists just each type, eg Architecture - Press - Events etc

    But I can't figure out how to filter on TV

    I've managed to use tagLister succesfully on the page but that uses a different TV, that has no pre-set options.

    I've looked at getResources, tagLister and getResourcesTag and various posts on here and can't get it to work.

    Any pointers please?

    Thanks, David

    ..........
    Web Server:

    * PHP 5.3.15
    * Apache/2.2.22

    Database:

    * MySQL version libmysql - 5.1.63

    MODx:

    * MODX Revolution 2.2.4-pl (traditional) [ed. note: DavidJColbran last edited this post 14 years, 1 month ago.]
      • 3109 ☆ A M B ☆
      • 894 Posts
      getResources will do this for you, just put a getResources call on each page and filter by the TV you want on each page. Something like this.

      
      [[!getResources?
              &parents=`idOfParentResource`
              &tpl=`tplChunkToUse`
              &tvFilters=`tvName`
              &includeTVs=`1`
              &processTVs=`1`
              &includeContent=`1`]]
      
      


      Make sure you put the ID of the resource that has the items you want to filter, if you want to filter all resources then it should be 0.

      Replace tplChunkToUse with the name of the chunk you will use and tvName to the name of the TV you want to filter by.

      That should do it for you.

      Hope that works.
        Benjamin Marte
        Interactive Media Developer
        Follow Me on Twitter | Visit my site | Learn MODX
        • 6723
        • 93 Posts
        Hi Ben, Thanks for responding.

        Tried using the &tvFilters before with getResources but no joy.

        This doesn't show anything;

        [[!getResources?
                &parents=`2`
                &tpl=`news-index-tpl`
                &tvFilters=`categoryoptions`
                &includeTVs=`1`
                &processTVs=`1`
                &includeContent=`1`]]


        Where as this does;

        [[!getResourcesTag? 
        &parents=`2` 
        &tagKey=`categoryoptions` 
        &tpl=`news-index-tpl` 
        &includeContent=`1`
        &includeTVs=`1` 
        &processTVs=`1`]]


        Which you can see here - http://www.djcdesign.co.uk/blog/category-architecture.htm

        But it's just showing the last 10 documents in folder, rather than those selected as 'Architecture' in the TV called 'categoryoptions'

        What I don't know is what to add to my call to filter the TV to just show the 'Architecture' documents.

        Cheers
          • 6723
          • 93 Posts
          Ok solved my problem - seems I'd been going around in circles, whereas getResources was the snippet to use and getting the syntax correct for the operators on tvFilters the key to solving it.

          This is the call that pulled out the correct documents;

          [[!getResources? &parents=`2` &tpl=`news-index-tpl` &includeTVs=`1` &processTVs=`1` &tvFilters=`categoryoptions==%Architecture%`]]


          My 'Input Option Values' were;

          Photography||Webdesign||Liverpool||Press||Events||People||Architecture||Music||Personal

          So I needed the wildcard operator % to go before and after 'Architecture' to select the correct documents categorized as Architecture, as most documents are in more than one category and to ignore the double pipe delimiter.

          Phew, took a while but got there - hopefully the above helps someone else !