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

    I have this situation in my resource tree:
    Portfolio
    -- Portfolio
      -- Category 1
          -- Project 1
          -- Project 2
          -- Project 3
       -- Category 2
          -- Project 1
          -- Project 2
          -- Project 3
       -- Category 3
          -- Project 1
          -- Project 2
          -- Project 3
    

    What i need with GetResources is push some custom fiels from all the Categories folders childrens, but i want to hide the Categories containers. How can i do that? I´m using the below code, but it´s not working!! sad

    Then in my PortfolioItem-Tpl i need to call the parents alias (Category 1 alias, Category 2 alias and so on...). How can i do this? Is there exist any [[+parent_alias]] ?

    My GetResources Call:
    [[!getResources? 
    &parents=`5` 
    &hideContainers=`1`
    &includeTVs=`1` 
    &processTVs=`1`						
    &tpl=`PortfolioItem-Tpl`
    ]]
    


    My PortfolioItem-Tpl:
    <div class="portfolio-item [[+alias *** Need parent alias here]]">
    	[[+tv.teste]]
    </div>
    


    Many thanks in advance!!!

    This question has been answered by multiple community members. See the first response.

    [ed. note: legues last edited this post 13 years, 10 months ago.]
    • discuss.answer
      • 22427
      • 793 Posts
      Is there exist any [[+parent_alias]] ?
      Use [[*alias]] (with asterisk).

      To observe for all the resource content fields:
      [[*........]] is referring to the page where the getResources call is in.
      [[+.......]] is referring to the actual item resource fetched by the snippet.
      • discuss.answer
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        That would only work if the getResources &parents value is the current resource. Otherwise, you'd need to use the getField snippet to return the alias of the parent.

        <div class="portfolio-item [[getField? &docid=`[[+parent]]` &field=`alias`]]">
            [[+tv.teste]]
        </div>

        http://modx.com/extras/package/getfield
          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
          • 16899
          • 284 Posts
          Hi guys, many thanks for your replies!!!! smiley And now how can i hide the Category folders from getresources results and show their childs?
            • 4172
            • 5,888 Posts

            Are your Category-folders marked as Containers? (is_folder = 1)

            Then &hideContainers=`1` should work. Otherwise its a bug, which should be reported.

            If your childs have another template than your containers you can try:

            &where=`{"template":"XXX"}`


            XXX is the id of your childs - template
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
              • 16899
              • 284 Posts
              Yes, they are container!!!! Now it´s working like a charm !!! smiley
              It´s pushing just my portfolio item!!!! I did it like you said
              &where=`{"template":"XXX"}`


              Now my getresources Tpl

              <div class="portfolio-item [[*alias]]">
                  [[+tv.teste]]
              </div>


              How can i get these "hidden category folders" alias on my child resources template? I tried the above solutions but i´s not working!!!:(
                • 4172
                • 5,888 Posts
                getField is for Evo. For Revo use getResourceField to get fields from other Resources
                  -------------------------------

                  you can buy me a beer, if you like MIGX

                  http://webcmsolutions.de/migx.html

                  Thanks!
                  • 16899
                  • 284 Posts
                  Quote from: Bruno17 at Nov 28, 2012, 04:51 AM
                  getField is for Evo. For Revo use getResourceField to get fields from other Resources

                  <div class="portfolio-item [[getResourceField? &id=`[[*parent]]` &field=`alias`]]">
                  	[[+tv.teste]]
                  </div>


                  I´m using this code, but it´s not working!!!!! Why?
                  • discuss.answer
                    • 4172
                    • 5,888 Posts
                    [[getResourceField? &id=`[[+parent]]` &field=`alias`]]
                      -------------------------------

                      you can buy me a beer, if you like MIGX

                      http://webcmsolutions.de/migx.html

                      Thanks!
                      • 16899
                      • 284 Posts
                      Quote from: Bruno17 at Nov 28, 2012, 05:19 AM
                      [[getResourceField? &id=`[[+parent]]` &field=`alias`]]

                      Got it working!!!!! You are a F%&$ing master!!!! Thanks a lot!!!!!!! smiley