We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • Quote from: bennyb at Jul 05, 2012, 02:57 PM
    Hey Susan,
    Do you mean some output/input filters for revo as phx is only Evo right?
    Ben
    Ok, you can say tomato and I'll say tomahto, but it boils down to the same ketchup. Besides, phx is easier to type than output/input when one is dyslexic!

    Of course, Jason is way ahead of me wink
      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
      • 22827
      • 129 Posts
      I used something like:

      [[getResources?
        &tplCondition=`isfolder`
        &conditionalTpls=`{"1":"aTemplate"}`
        &tpl=`aTemplate`
      ]]


      The idea being that I wanted to show a different output for a container than for a document. This resulted in the "Array()" showing error - even though I am using the same template for the conditional as for the other.

      If I take out the conditionals, it works fine. I tried using "template" as a variable, and got the same "Array()" error even though none of the getResources documents would have matched.

      Have I got something wrong?

      modx 2.2.4-pl
      getresources 1.5.1 (I think - the latest one).
        • 34197
        • 138 Posts
        Hi @opengeek,


        I am really interested to use your method for a slider. I just don't understand what I have to include for "tplCondition"


        Here is what I have:

                            
        [[getResources?
          &parents=`678`
          &tplCondition=`Templates`
          &conditionalTpls=`{"1":"tabs1","2":"tabs2","3":"tabs3","4":"tabs4","5":"tabs5","6":"tabs6"}`
          &tpl=`tabs`
          &showHidden=`1`
          &limit=`6`
          &includeTVs=`2`
        ]]
        


        So, if I am not wrong, in "&tpl" and "&conditionalTpls" I have included the different chuncks, but I am just wondering what I am suppose to do for "&tplCondition", is it a chunck, a tv ?


        Thanks for your help.
          Webdesigner and musician.
        • It's the name of the Resource field whose value is evaluated against the conditionalTpls you specify.
            • 34197
            • 138 Posts
            Hi opengeek, thanks for help.

            Actually, I have used another feature of getresource (tpl_N) and it worked like a charm, see here:
            http://rtfm.modx.com/display/ADDON/getResources#getResources-TemplatingProperties


            Of course, because you're the one who's editing the plugin I am not teaching you anything lol, but it may help the others.


              Webdesigner and musician.
            • Quote from: opengeek at Jul 05, 2012, 03:20 PM
              In the latest release of getResources (1.5.0-pl) there is a new feature for conditional tpls:

              [[getResources?
                &tplCondition=`template`
                &conditionalTpls=`{"1":"tplA","2":"tplB","3":"tplC"}`
              ]]

              Great stuff! Did find this here by accident. Would be great to have that documented in the RTFM for everybody to see.
              Are there any other cool secret features?
                MINDEFFECTS – DESIGN for PRINT, WEB and MEDIA
                http://twitter.com/mindeffects · http://www.facebook.com/mindeffects · http://www.youtube.com/mindeffects/ · skype://mindeffects_oliver
                • 45479
                • 18 Posts
                Sorry, I'm into MODx just one month now and I don't get it. I have to render the children of the two parents with two different tpls. The children of 4 with tpl "hs-news", the children of 18 with tpl "hs-outlet".
                [[getResources?
                  &parents=`4,18`
                  &tplCondition=`Templates`
                  &conditionalTpls=`{"1":"hs-news","2":"hs-outlet"}`
                  &tpl=`hs-news`
                  &includeTVs=`1`
                  &sortby=`{"publishedon":"DESC"}`
                ]]
                

                Now I'm stuck with the tplCondition. What has to happen there?
                It's the name of the Resource field whose value is evaluated against the conditionalTpls you specify.
                What resource field with what kind of value? Would somebody who obviously got this be so kind to explain this part in detail? Would appreciate it very much!
                  • 36926
                  • 701 Posts
                  Quote from: rotter at Oct 31, 2013, 11:47 AM
                  Sorry, I'm into MODx just one month now and I don't get it. I have to render the children of the two parents with two different tpls. The children of 4 with tpl "hs-news", the children of 18 with tpl "hs-outlet".
                  [[getResources?
                    &parents=`4,18`
                    &tplCondition=`Templates`
                    &conditionalTpls=`{"1":"hs-news","2":"hs-outlet"}`
                    &tpl=`hs-news`
                    &includeTVs=`1`
                    &sortby=`{"publishedon":"DESC"}`
                  ]]
                  

                  Now I'm stuck with the tplCondition. What has to happen there?
                  It's the name of the Resource field whose value is evaluated against the conditionalTpls you specify.
                  What resource field with what kind of value? Would somebody who obviously got this be so kind to explain this part in detail? Would appreciate it very much!

                  Hey rotter,

                  I'm not 100% you can do the condition using the parent, but you could try changing the following.
                  &tplCondition=`parent`
                  &conditionalTpls=`{"XX":"hs-news","XX":"hs-outlet"}`
                  

                  The values of "XX" are the IDs of the parent resources. So in your case 4 and 18.

                  Ben
                    • 36926
                    • 701 Posts
                    @rotter. Also how different do hs-news and hs-outlet differ? As you could just use some output filters.
                    • You need the tplCondition to be the name of the field whose value you want to compare to the keys in your conditionalTpls. These are the same fields you would use in the sortby, or in field tags, e.g. [[*pagetitle]].

                      In your case you want the tplCondition to be template.

                      [[getResources?
                        &parents=`4,18`
                        &tplCondition=`template`
                        &conditionalTpls=`{"1":"hs-news","2":"hs-outlet"}`
                        &tpl=`hs-news`
                        &includeTVs=`1`
                        &sortby=`{"publishedon":"DESC"}`
                      ]]