We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 31255
    • 118 Posts
    Hi!
    I know this is easy job, but I`m not familiar with filtering tv`s.

    Try to do same thing that done with ditto. Showing resources that had marked to show. In this case in tv user set up number one in text field (0 is default) and it will show where it called.

    Here`s my call:

    [[!getResources:default=`Ei uutisia tällä hetkellä!`? &depth=`0` &parents=`0`  &tpl=`naytaetusivulla-tpl` &tvFilters=`tv.ShowOnHomepage!=` &includeTVs=`1` &processTVs=`1`  ]]


    It shows resources that are at root level except last resource (Why is that?). But not the page that has marked number 1. I know that filterin is the key but how to do it?

    And if you can tell me how i can make same tv so that user can choose no 1 value from dropdown list.
      Tassu, webmaster of Valokammi
      • 36624
      • 535 Posts
      Quote from: valokammi at Nov 15, 2012, 11:19 PM
      Hi!
      I know this is easy job, but I`m not familiar with filtering tv`s.

      Try to do same thing that done with ditto. Showing resources that had marked to show. In this case in tv user set up number one in text field (0 is default) and it will show where it called.

      Here`s my call:

      [[!getResources:default=`Ei uutisia tällä hetkellä!`? &depth=`0` &parents=`0`  &tpl=`naytaetusivulla-tpl` &tvFilters=`tv.ShowOnHomepage!=` &includeTVs=`1` &processTVs=`1`  ]]


      It shows resources that are at root level except last resource (Why is that?). But not the page that has marked number 1. I know that filterin is the key but how to do it?

      And if you can tell me how i can make same tv so that user can choose no 1 value from dropdown list.

      1) don't use prefixes of TVs (tv.) in a snippet call.. use prefixes only in chunks..
      2) use &limit=`10`to see more resources (defaut is 5..)

      3) I would use a TV type Checkbox to make what you want.. make it 0 by default and 1 if set then your filter could look like &tvFilters=`ShowOnHomepage==1`
      more info in the doc :
      http://rtfm.modx.com/display/revolution20/Template+Variable+Input+Types#TemplateVariableInputTypes-SimpleUsage
        CTRL+SHIFT+U - Clear Cache
        CTRL+SHIFT+H - Hiding Heft Panel
        CTRL+SHIFT+N - Fast Create Resource
        CTRL+ALT+P - Preview Recource (in edit resorce window)
        CTRL+ALT+S - Save
        • 31255
        • 118 Posts
        This is situation now:
        TV:
        name: nostot

        Input options:
        Input Type:Listbox (single select)
        Input Option Values: Ei näytetä==0||Näytetään sivulla==1
        (finnish lang sorry, 1= show page)

        Default:0

        Output options:
        Default

        getresources call:
        [[!getResources:default=`Ei uutisia tällä hetkellä!`? &depth=`0` &parents=`0` &includeTVs=`1` &processTVs=`1` &tvPrefix=`` &tpl=`nostot-tpl` &tvFilters=`nostot==1`]]
        


        TPL:
        <p class="nice green full-width radius button"><a href="[[~[[+id]]]]" title="[[+pagetitle]]">[[+pagetitle]]</a></p>
        <p>[[+introtext:ellipsis=`150`:strip_tags=``]] <a href="[[~[[+id]]]]">Lue lisää...</a></p>



        With this call and tpl shows default text. Not pages marked 1. Is there a problem in tpl? [ed. note: valokammi last edited this post 11 years, 4 months ago.]
          Tassu, webmaster of Valokammi
          • 36624
          • 535 Posts
          in my opinion what you did should work... but you can try with:

          &tvFilters=`nostot>=1`

          to find the problem you can (temporary) output the nostot TV with [[+nostot]] in your chunk or leave the &tpl to see the debug array.. you should see some resources with 1 and other with 0..
            CTRL+SHIFT+U - Clear Cache
            CTRL+SHIFT+H - Hiding Heft Panel
            CTRL+SHIFT+N - Fast Create Resource
            CTRL+ALT+P - Preview Recource (in edit resorce window)
            CTRL+ALT+S - Save
            • 31255
            • 118 Posts
            I removed &tpl=`nostot-tpl` in the chunk. No change in front end (default text). No debug array.

            Put [[+nostot]] to chunk only with getrresources call, then there`s debug array. It seems to list child pages of source, no pages marked 1.

            [[!getResources:default=`Ei uutisia tällä hetkellä!`? [[+nostot]]]]


            Here`s debug array:

            Array ( [tpl] =>  [tplOdd] =>  [tplFirst] =>  [tplLast] =>  [sortby] => publishedon [sortbyTV] =>  [sortbyTVType] => string [sortbyAlias] =>  [sortbyEscaped] => 0 [sortdir] => DESC [sortdirTV] => DESC [limit] => 5 [offset] => 0 [tvFilters] =>  [tvFiltersAndDelimiter] => , [tvFiltersOrDelimiter] => || [depth] => 10 [parents] =>  [includeContent] =>  [includeTVs] =>  [includeTVList] =>  [showHidden] =>  [showUnpublished] =>  [showDeleted] =>  [resources] =>  [processTVs] =>  [processTVList] =>  [prepareTVs] => 1 [prepareTVList] =>  [tvPrefix] => tv. [idx] => 1 [first] => 1 [last] => 5 [toPlaceholder] =>  [toSeparatePlaceholders] =>  [debug] =>  [where] =>  [dbCacheFlag] => 0 [context] =>  [tplCondition] =>  [tplOperator] => == [conditionalTpls] =>  [odd] => 1 [id] => 48 [type] => document [contentType] => text/html [pagetitle] => Henkilökunta [longtitle] =>  [description] =>  [alias] => henkilokunta [link_attributes] =>  [published] => 1 [pub_date] => 0 [unpub_date] => 0 [parent] => 1 [isfolder] => 1 [introtext] => Valokammin tyypit... [richtext] => 1 [template] => 6 [menuindex] => 0 [searchable] => 1 [cacheable] => 1 [createdby] => 1 [createdon] => 2012-11-13 13:00:12 [editedby] => 1 [editedon] => 2012-11-13 13:01:57 [deleted] =>  [deletedon] => 0 [deletedby] => 0 [publishedon] => 2012-11-13 13:00:00 [publishedby] => 1 [menutitle] => Henkilökunta [donthit] =>  [privateweb] =>  [privatemgr] =>  [content_dispo] => 0 [hidemenu] =>  [class_key] => modDocument [context_key] => web [content_type] => 1 [uri] => valokuvaamo-valokammi/henkilokunta/ [uri_override] => 0 [hide_children_in_tree] => 0 [show_in_tree] => 1 [properties] =>  ) 
            Array ( [tpl] =>  [tplOdd] =>  [tplFirst] =>  [tplLast] =>  [sortby] => publishedon [sortbyTV] =>  [sortbyTVType] => string [sortbyAlias] =>  [sortbyEscaped] => 0 [sortdir] => DESC [sortdirTV] => DESC [limit] => 5 [offset] => 0 [tvFilters] =>  [tvFiltersAndDelimiter] => , [tvFiltersOrDelimiter] => || [depth] => 10 [parents] =>  [includeContent] =>  [includeTVs] =>  [includeTVList] =>  [showHidden] =>  [showUnpublished] =>  [showDeleted] =>  [resources] =>  [processTVs] =>  [processTVList] =>  [prepareTVs] => 1 [prepareTVList] =>  [tvPrefix] => tv. [idx] => 2 [first] => 1 [last] => 5 [toPlaceholder] =>  [toSeparatePlaceholders] =>  [debug] =>  [where] =>  [dbCacheFlag] => 0 [context] =>  [tplCondition] =>  [tplOperator] => == [conditionalTpls] =>  [odd] => 0 [id] => 43 [type] => document [contentType] => text/html [pagetitle] => Tassun jäljet [longtitle] =>  [description] =>  [alias] => tassun-jaljet [link_attributes] =>  [published] => 1 [pub_date] => 0 [unpub_date] => 0 [parent] => 21 [isfolder] =>  [introtext] => Kotisivuni täynnä pohjoisia valotuksia. Lisäksi revontuli/ avaruussää linkkejä ja ennusteita. [richtext] => 1 [template] => 6 [menuindex] => 1 [searchable] => 1 [cacheable] => 1 [createdby] => 3 [createdon] => 2012-11-10 13:41:47 [editedby] => 3 [editedon] => 2012-11-10 13:44:49 [deleted] =>  [deletedon] => 0 [deletedby] => 0 [publishedon] => 2012-11-10 13:42:00 [publishedby] => 3 [menutitle] => Tassun jäljet [donthit] =>  [privateweb] =>  [privatemgr] =>  [content_dispo] => 0 [hidemenu] =>  [class_key] => modWebLink [context_key] => web [content_type] => 1 [uri] => valokuvaamo-valokammi/henkilokunta/vesa-sarkela/tassun-jaljet.html [uri_override] => 0 [hide_children_in_tree] => 0 [show_in_tree] => 1 [properties] => Array ( [core] => Array ( [responseCode] => HTTP/1.1 301 Moved Permanently )  )  ) 
            Array ( [tpl] =>  [tplOdd] =>  [tplFirst] =>  [tplLast] =>  [sortby] => publishedon [sortbyTV] =>  [sortbyTVType] => string [sortbyAlias] =>  [sortbyEscaped] => 0 [sortdir] => DESC [sortdirTV] => DESC [limit] => 5 [offset] => 0 [tvFilters] =>  [tvFiltersAndDelimiter] => , [tvFiltersOrDelimiter] => || [depth] => 10 [parents] =>  [includeContent] =>  [includeTVs] =>  [includeTVList] =>  [showHidden] =>  [showUnpublished] =>  [showDeleted] =>  [resources] =>  [processTVs] =>  [processTVList] =>  [prepareTVs] => 1 [prepareTVList] =>  [tvPrefix] => tv. [idx] => 3 [first] => 1 [last] => 5 [toPlaceholder] =>  [toSeparatePlaceholders] =>  [debug] =>  [where] =>  [dbCacheFlag] => 0 [context] =>  [tplCondition] =>  [tplOperator] => == [conditionalTpls] =>  [odd] => 1 [id] => 21 [type] => document [contentType] => text/html [pagetitle] => Vesa Särkelä [longtitle] =>  [description] =>  [alias] => vesa-sarkela [link_attributes] =>  [published] => 1 [pub_date] => 0 [unpub_date] => 0 [parent] => 48 [isfolder] => 1 [introtext] => Olen harrastanut valokuvausta... Aika kauan. -Olen valonpalvoja. [richtext] => 1 [template] => 6 [menuindex] => 0 [searchable] => 1 [cacheable] => 1 [createdby] => 1 [createdon] => 2012-11-03 16:54:31 [editedby] => 3 [editedon] => 2012-11-10 14:17:53 [deleted] =>  [deletedon] => 0 [deletedby] => 0 [publishedon] => 2012-11-03 16:54:00 [publishedby] => 1 [menutitle] => Vesa Särkelä [donthit] =>  [privateweb] =>  [privatemgr] =>  [content_dispo] => 0 [hidemenu] =>  [class_key] => modDocument [context_key] => web [content_type] => 1 [uri] => valokuvaamo-valokammi/henkilokunta/vesa-sarkela/ [uri_override] => 0 [hide_children_in_tree] => 0 [show_in_tree] => 1 [properties] =>  ) 
            Array ( [tpl] =>  [tplOdd] =>  [tplFirst] =>  [tplLast] =>  [sortby] => publishedon [sortbyTV] =>  [sortbyTVType] => string [sortbyAlias] =>  [sortbyEscaped] => 0 [sortdir] => DESC [sortdirTV] => DESC [limit] => 5 [offset] => 0 [tvFilters] =>  [tvFiltersAndDelimiter] => , [tvFiltersOrDelimiter] => || [depth] => 10 [parents] =>  [includeContent] =>  [includeTVs] =>  [includeTVList] =>  [showHidden] =>  [showUnpublished] =>  [showDeleted] =>  [resources] =>  [processTVs] =>  [processTVList] =>  [prepareTVs] => 1 [prepareTVList] =>  [tvPrefix] => tv. [idx] => 4 [first] => 1 [last] => 5 [toPlaceholder] =>  [toSeparatePlaceholders] =>  [debug] =>  [where] =>  [dbCacheFlag] => 0 [context] =>  [tplCondition] =>  [tplOperator] => == [conditionalTpls] =>  [odd] => 0 [id] => 20 [type] => document [contentType] => text/html [pagetitle] => Tekijänoikeudet [longtitle] =>  [description] =>  [alias] => tekijanoikeudet [link_attributes] =>  [published] => 1 [pub_date] => 0 [unpub_date] => 0 [parent] => 1 [isfolder] =>  [introtext] => Yleiset tekijänoikeudet Valokammin kotisivuilla oleville kuville. [richtext] => 1 [template] => 10 [menuindex] => 2 [searchable] => 1 [cacheable] => 1 [createdby] => 1 [createdon] => 2012-11-03 16:50:07 [editedby] => 3 [editedon] => 2012-11-28 13:31:21 [deleted] =>  [deletedon] => 0 [deletedby] => 0 [publishedon] => 2012-11-03 16:50:00 [publishedby] => 1 [menutitle] => Tekijänoikeudet [donthit] =>  [privateweb] =>  [privatemgr] =>  [content_dispo] => 0 [hidemenu] =>  [class_key] => modDocument [context_key] => web [content_type] => 1 [uri] => valokuvaamo-valokammi/tekijanoikeudet.html [uri_override] => 0 [hide_children_in_tree] => 0 [show_in_tree] => 1 [properties] =>  ) 
            Array ( [tpl] =>  [tplOdd] =>  [tplFirst] =>  [tplLast] =>  [sortby] => publishedon [sortbyTV] =>  [sortbyTVType] => string [sortbyAlias] =>  [sortbyEscaped] => 0 [sortdir] => DESC [sortdirTV] => DESC [limit] => 5 [offset] => 0 [tvFilters] =>  [tvFiltersAndDelimiter] => , [tvFiltersOrDelimiter] => || [depth] => 10 [parents] =>  [includeContent] =>  [includeTVs] =>  [includeTVList] =>  [showHidden] =>  [showUnpublished] =>  [showDeleted] =>  [resources] =>  [processTVs] =>  [processTVList] =>  [prepareTVs] => 1 [prepareTVList] =>  [tvPrefix] => tv. [idx] => 5 [first] => 1 [last] => 5 [toPlaceholder] =>  [toSeparatePlaceholders] =>  [debug] =>  [where] =>  [dbCacheFlag] => 0 [context] =>  [tplCondition] =>  [tplOperator] => == [conditionalTpls] =>  [odd] => 1 [id] => 10 [type] => document [contentType] => text/html [pagetitle] => Yksityisyyden suoja [longtitle] =>  [description] =>  [alias] => privacy [link_attributes] =>  [published] => 1 [pub_date] => 0 [unpub_date] => 0 [parent] => 1 [isfolder] => 1 [introtext] => Valokammin yksityisyyden suoja. [richtext] => 1 [template] => 6 [menuindex] => 1 [searchable] => 1 [cacheable] => 1 [createdby] => 1 [createdon] => 2012-11-03 13:35:34 [editedby] => 3 [editedon] => 2012-11-28 14:16:47 [deleted] =>  [deletedon] => 0 [deletedby] => 0 [publishedon] => 2012-11-03 13:35:00 [publishedby] => 1 [menutitle] => Yksityisyyden suoja [donthit] =>  [privateweb] =>  [privatemgr] =>  [content_dispo] => 0 [hidemenu] =>  [class_key] => modDocument [context_key] => web [content_type] => 1 [uri] => valokuvaamo-valokammi/privacy/ [uri_override] => 0 [hide_children_in_tree] => 0 [show_in_tree] => 1 [properties] =>  )
              Tassu, webmaster of Valokammi
              • 36624
              • 535 Posts
              well..

              for the output array try only that :

              [[!getResources? &depth=`0` &parents=`0` &includeTVs=`1` &processTVs=`1` &tvPrefix=`` ]]

              and when i said to put the TV in your chunk i mean like that :

              <p class="nice green full-width radius button"><a href="[[~[[+id]]]]" title="[[+pagetitle]]">[[+pagetitle]]</a></p>
              [b]<p> visible on homepage : [[+nostot]] (1=yes,0=no)</p>[/b]

                CTRL+SHIFT+U - Clear Cache
                CTRL+SHIFT+H - Hiding Heft Panel
                CTRL+SHIFT+N - Fast Create Resource
                CTRL+ALT+P - Preview Recource (in edit resorce window)
                CTRL+ALT+S - Save
              • Quote from: valokammi at Dec 04, 2012, 03:44 PM
                This is situation now:
                TV:
                name: nostot

                Input options:
                Input Type:Listbox (single select)
                Input Option Values: Ei näytetä==0||Näytetään sivulla==1
                (finnish lang sorry, 1= show page)

                Default:0

                Output options:
                Default

                getresources call:
                [[!getResources:default=`Ei uutisia tällä hetkellä!`? &depth=`0` &parents=`0` &includeTVs=`1` &processTVs=`1` &tvPrefix=`` &tpl=`nostot-tpl` &tvFilters=`nostot==1`]]
                


                TPL:
                <p class="nice green full-width radius button"><a href="[[~[[+id]]]]" title="[[+pagetitle]]">[[+pagetitle]]</a></p>
                <p>[[+introtext:ellipsis=`150`:strip_tags=``]] <a href="[[~[[+id]]]]">Lue lisää...</a></p>



                With this call and tpl shows default text. Not pages marked 1. Is there a problem in tpl?

                Try it without a default value. Whenever I have a default value for a template variable I need to filter via getResources &tvFilters the filter does not work. Once the TV does not have a default value it works. I had to be reminded of this today and found a 2 year old thread with this solution.
                  • 31255
                  • 118 Posts
                  Try it without a default value. Whenever I have a default value for a template variable I need to filter via getResources &tvFilters the filter does not work. Once the TV does not have a default value it works. I had to be reminded of this today and found a 2 year old thread with this solution.

                  Not working. Shows only default text.

                  I know that there`s a solution somewhere, but I did not find it. Link would be nice.
                    Tassu, webmaster of Valokammi
                    • 36624
                    • 535 Posts
                    ...maybe you should use Wayfinder for this job.

                    btw your call are ok i just copy your setup and well it works..

                    so maybe, change the chunk name.. remove element until it works..
                      CTRL+SHIFT+U - Clear Cache
                      CTRL+SHIFT+H - Hiding Heft Panel
                      CTRL+SHIFT+N - Fast Create Resource
                      CTRL+ALT+P - Preview Recource (in edit resorce window)
                      CTRL+ALT+S - Save
                    • Quote from: valokammi at Dec 06, 2012, 06:33 AM
                      Try it without a default value. Whenever I have a default value for a template variable I need to filter via getResources &tvFilters the filter does not work. Once the TV does not have a default value it works. I had to be reminded of this today and found a 2 year old thread with this solution.

                      Not working. Shows only default text.

                      I know that there`s a solution somewhere, but I did not find it. Link would be nice.

                      http://forums.modx.com/thread/43621/tvfilters-issue#dis-post-251301

                      But I don't see the use if it didn't fix the problem.