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

    I would like to know how to use wayfinder where argument with template variable ! like
    I've got a list of resources with a tv named "thumb" (for example), and, in my snippet call :

    [[!wayfinder?
    &startId=`0`
    &where=`[{"thumb:!=": ""}]`]]
    


    for show only resources in wayfinder who've got a thumb, but, I don't now how to include this 'thumb' named tv in the snippet !
    In the wayfinder class a tvlist properties exist, but how it work ?

    Version of wayfinder : 2.3.3-pl

    29:        public $tvList = array ();
    

    See also lines : 337, 672, 679

    low
      Low
    • You should be able to add the property &tvlist=`thumb`

      It takes a comma-separated list of TVs to process.
        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
      • The processTV snippet goes into your tpl chunk that contains the thumbnail source.

        http://rtfm.modx.com/extras/revo/wayfinder

        Template Parameters

        These parameters specify the chunks that contain the templates that will drive the generation of Wayfinder's output.

        With the current version of WayFinder in Revolution, you can access your own custom TVs by using a placeholder without the 'wf.' prefix, e.g. [[+my_TV]]

        As of this writing, only the raw TV value will be returned: it will not be formatted. E.g. if your TV is an image, normal use of the TV inside your template would return the full image tag, but inside of a WayFinder tpl, only the path to the image will be returned.

        If you want MODX 2.x to process a TV (e.g. an image TV with a base path/url as an input option (since MODX 2.1.x) or with an @inherit value) you might do that by calling a snippet within the wayfinder row template (&rowTpl). Let's say, your image TV is named icon. Normally you would use some code thing like this:


        ... <img src="[[+icon]]" /> ...
        

        But it will not get you the fully processes TV. Just change your code to this:

        ... <img src="[[processTV? &myId=`[[+id]]` &myTV=`icon` ]]" /> ...


        Within the snippet processTV you place this php-code:

        	
        <?php
        $doc = $modx->getObject('modResource', $myId);
        return $doc->getTVValue($myTV);
        

        As a result the full processed image TV is returned.
          Frogabog- MODX Websites in Portland Oregon
          "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
          Having server issues? These guys have MODX Hosting perfected - SkyToaster
        • Oh yeah, what Susan said too. Doesn't &processTVs=`1` also need to be added to the Wayfinder snippet?
            Frogabog- MODX Websites in Portland Oregon
            "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
            Having server issues? These guys have MODX Hosting perfected - SkyToaster
          • I didn't see anything about that in the code.
              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
              • 17546
              • 75 Posts
              I don't want to process the tv, just to produce the wayfinder if a tv exist in a resource !

              Different way !
              create a TV named menuCategory
              Have got some different menuCategory values (numbered; 1, 2, etc...)
              In my resource, I want to procuce a menu with wayfinder and menuCategory = 2 !

              low
                Low
              • This is what I was looking at, in the new docs. ?? Might be wrong.

                As of this writing, only the raw TV value will be returned: it will not be formatted. E.g. if your TV is an image, normal use of the TV inside your template would return the full image tag, but inside of a WayFinder tpl, only the path to the image will be returned.

                  Frogabog- MODX Websites in Portland Oregon
                  "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
                  Having server issues? These guys have MODX Hosting perfected - SkyToaster
                • Sorry, thought you wanted the thumbnail to appear in the menu.

                  I think I'd probably use pdoTools for that instead. Or getResources.
                  http://docs.modx.pro/en/components/pdotools/general-settings
                    Frogabog- MODX Websites in Portland Oregon
                    "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
                    Having server issues? These guys have MODX Hosting perfected - SkyToaster
                  • Yeah, pdoMenu offers some interesting options that Wayfinder doesn't.
                      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
                      • 17546
                      • 75 Posts
                      If I put in the tpl this code:

                      ...
                      [[+myTemplateVar]]
                      ...
                      


                      I can see it, no problem about it !

                      But, it's not what I want, I want to use the value of a TV to use the where clause in the wayfinder snippet.

                      [[!wayfinder?
                      &startId=`0`
                      &where=`[{"myTemplateVar:!= ""}]`]]
                      


                      if myTemplateVar is not empty, the wayfinder get the resource to produce the menu.

                      the &tvlist=`myTemplateVar` argument do not work ! (and I can't see it in the snippet or class of wayfinder)
                        Low