We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10378
    • 375 Posts
    Hello,

    is it possible to filter resources in Wayfinder (Revolution) based on TVs?

    I have 2 TVs (checkboxes) showInMainMenu and showInFooterMenu.
    I'd like to give an editor the possibility to set a checkbox value, to decide in which menu the resource will be displayed.

    Can this be done with output filters or do I have to write a snippet?

    Thanks in advance,
    Martin
      Freelancer @bitego http://www.bitego.com
      ---
      GoodNews - one of the most advanced and integrated Group Mailer premium add-ons for MODX Revolution!
      More infos here: http://www.bitego.com/extras/goodnews/
      • 22427
      • 793 Posts
      You could use an explicit &rowTpl wherein you decide by a phx statement by an output modifier in which way to display the item, dependent on the value of the TV. If the TV is unchecked, the &rowTpl could give an empty output.

      The Wayfinder call for the Footer Menu would use a similar &rowTpl, but refering to the second TV.

      Edit:
      Sorry, we're in Revo... [ed. note: ottogal last edited this post 12 years, 2 months ago.]
        • 22427
        • 793 Posts
        Sorry, I don't find the time to get into this. But I think that writing a snippet is the better choice over output filters. The Wayfinder should have the snippet call in its &rowTpl parameter, like
        &rowTpl=`[[!GetRow]]`

        and the snippet GetRow should return the normal row template chunk or an empty string, dependent on the value of the TV.
        (You need two versions of the snippet, one for each of the menus or TVs, respectively.)
          • 38630
          • 21 Posts
          I have been trying work out what I could be doing wrong for a while without much luck.

          I want to dynamically set the startId in the Wayfinder call in Revo.
          I have set up a custom config and by turning on debug I can see that the config is being loaded. I was hoping to use $_GET['ID'] to pull the ID from the querystring I want wayfinder to use as the start ID.

          As this didn't work, I decided hard code the startId into the config to test. Wayfinder seems to be ignoring this as well.

          This is my Wayfinder call:
          [[!Wayfinder?config=`acn` &debug=`yes` &rowTpl=`rowTpl` &outerTpl=`outerTpl`]]


          This is the config:

          <?php
          $startId = 59;

          Wayfinder just ignores the startId altogether and uses the current ID.

          Any ideas?

          Thanks [ed. note: [email protected] last edited this post 12 years, 2 months ago.]
            • 22427
            • 793 Posts
            I was hoping to use $_GET['ID'] to pull the ID from the querystring
            At least that should be $_GET['id'], since the query string parameter is id (lower case).
            How is your Wayfinder call?
              • 38630
              • 21 Posts
              Sorry, I didn't put the Wayfinder call in a code block. It is visible now.

              I don't think it matters that $_GET['ID'] is uppercase if that is how it is included in the querystring..
              Anyway, as I hard coded the $startId in the config this does not make any differenece at this stage. Wayfinder appears to ignore the config altogether.
                • 22427
                • 793 Posts
                As far as I observed, Wayfinder does not ignore the config as a whole, but the $startId in it ( $level=1 for example is not ignored).
                May be the startId plays a special role. When I tried to use a property set (a copy of the default one) instead of the config file, I found that the parameter startId is not listed in the property set.
                Can someone shed a bit light on this?
                  • 8537
                  • 26 Posts
                  Hello,

                  This is an old post, but it may help ...

                  I finally found a solution (in MODX Evolution) to this problem using Ditto to produce a coma separated list of Ids in the Wayfinder parameter &includeDocs.

                  [!Wayfinder? &startId=`0` &level=`2` &includeDocs=`[[Ditto? &parents=`0` &start=`0` &depth=`3` &tpl=`menu` &tplLast=`menu_last` &tplFirst=`menu_first` &filter=`my_TV,valeur,7` ]]` !]


                  - Carfully check the cash settings in both ditto and wayfinder calls !
                  - Beware that the Ditto &filter parameter works with exclusions !

                  The Ditto templates include the following chunk format :

                  menu_first :
                  [+id+]

                  menu :
                  ,[+id+]

                  menu_last :
                  ,[+id+]


                  You can thus get menu elements that depend on a TV value.
                    • 3749
                    • 24,544 Posts
                    @ottogal - You're right. I was surprised to find that &startId is not in the default properties list in Wayfinder. I strongly suspect, though, that if you added it to the property set, it would work as usual.
                      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