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

    I create 3 Templare Variable (TV). Two for dates, and one for a text (place)
    I allowd the TVs for a template and I craete serveral resources. Each ressource is contain en event information and I enter the start and end date and the location because of the TV.

    Let's say, I have 20 event resource.

    I also create a simple form, where I can enter a location and a date. When I search, I want to have all event matching the the form criteria.

    I have no idea how to develop the script to extract and list the filtered resource from the MODx database, keeping in mind that we filter TV linked to the needed ressource

    May I ask you to give me some tips?

    Thank a lot

    This question has been answered by pierrot1010. See the first response.

      • 3749
      • 24,544 Posts
      Look at the getResources extra and its &tvFilters property.

      You can also use pdoResources, which is very similar and significantly faster, but not quite as well documented.
        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
        • 52678
        • 14 Posts
        Actually I want the same thing BOb...
          • 36931
          • 206 Posts
          Quote from: BobRay at Nov 09, 2016, 01:01 PM
          Look at the getResources extra and its &tvFilters property.

          You can also use pdoResources, which is very similar and significantly faster, but not quite as well documented.

          Dear Bob
          Thank for your answer. I call my menu as the following:
          [[!Wayfinder? &startId=`[[*id]]` &level=`1` &sortBy=`unpub_date` &sortOredr=`DESC` &outerClass=`ul-stage` &levelClass=`level` &innerClass=`questIn` &hideSubMenus=`1` &rowTpl=`rowTplStage` &hereClass ]]
          


          I created a rowTpl named 'rowTplStage' to have a template for my li, where I included getResource
          <li class="[[+wf.classnames]]">
            <a href="[[+wf.link]]" title="[[+wf.title]]" [[+wf.attributes]]> [[+wf.linktext]]
            id: [[+wf.docid]]</a>, [[getResources? &parents=`[[+wf.docid]]` &includeTVs=`1` &processTVs=`1` &prepareTVList=`5`]] - [[
            [[+wf.wrapper]]
          </li>
          

          and of course it does not work.

          The idea is to have displayed the value of the TV with the id 5

          I red, we need to include this &includeTVs=`1` &processTVs=`1` and I include &prepareTVList=`5` to specify which TV.

          I am sure, I am not using well getResource and may be I need help shocked)

          Could you tell me more about pdoResources? If it's faster, I am more interested!

          Many thank
            • 3749
            • 24,544 Posts
            You should use getResources until you have it working. Usually, you don't use Wayfinder and getResources together, though I'm not sure what you're trying to do.

            getResources alone might do the job, but you'll have to use the &tvFilters property to get the resources based on the TV. I don't think you need the &prepareTVList property.
              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
            • discuss.answer
              • 36931
              • 206 Posts
              This works well!
              https://docs.modx.com/extras/evo/wayfinder#Wayfinder-TemplateParameters
              I added [[+stage_place]] in my rowTpl
              [[!Wayfinder? &startId=`[[*id]]` &level=`1` &sortBy=`unpub_date` &sortOredr=`DESC` &outerClass=`ul-stage` &levelClass=`level` &innerClass=`questIn` &hideSubMenus=`1` &rowTpl=`rowTplStage` &hereClass ]]
              

              &rowTpl named 'rowTplStage'
              <li class="[[+wf.classnames]]">
                <a href="[[+wf.link]]" title="[[+wf.title]]" [[+wf.attributes]]> [[+wf.linktext]], <em>[[+stage_place]]</em></a>
                [[+wf.wrapper]]
              </li>

              where [[+stage_place]] is the name of my TV
                • 3749
                • 24,544 Posts
                Sorry, I thought you wanted to select resources based on the TV's content, rather than just showing its value.

                BTW, you don't need the &hereClass property if you're not giving it a value.
                  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