We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8694
    • 61 Posts
    I try this with the same result:
    [[!If?
    &subject=`10`
    &operator=`gt`
    &operand=`7`
    &then=`[[$tplStatusB]]`
    &else=`[[$tplStatusBnew]]`
    ]]
      • 1778
      • 659 Posts
      Hello,

      What is your getResource call ?
        • 8694
        • 61 Posts
        Hi,

        the call is this:
        [[getResources? &parents=`31` &tpl=`p_item` &includeTVs=`1` &processTVs=`1` &limit=`500`]]


        p_item contains the IF stuff.
          • 1778
          • 659 Posts
          It seems ok... May be you can workaround this by maiking your IF test with the GetResource call and not inside it ? (just a thought agian I did not test it)... Something like this (assuming you are using a placeholder for nbofdays)

          [[!If?
            &subject=`[[+nbofdays]]`  //I suppose you can call directly your snippet getDateDif here, I feel more comfortable with ph
            &operator=`GT`
            &operand=`7`
            &then=`[[!getResources? &parents=`31` &tpl=`tplStatusB` &includeTVs=`1` &processTVs=`1` &limit=`500`]]`
            &else=`[[!getResources? &parents=`31` &tpl=`tplStatusBNew` &includeTVs=`1` &processTVs=`1` &limit=`500`]]`
          ]]
          


          Cheers
            • 8694
            • 61 Posts
            Hi Anso,

            I thing this will not do want I want.
            When I would put that e.g. in the HOME site. The Snippet will get me the age (in days) of the home site.


              • 1778
              • 659 Posts
              Ah yes... your snippet getDateDif is running on current doc (eg the home page in your case)

              An other way would be to put getDateDif in your docs, store the value in a TV (ageOfDoc) and work with this TV ? Not the most direct way I guess, and not sure of its efficacity... I’m just thinking with you on how to solve this...
                • 8694
                • 61 Posts
                Hm...I think the problem is that the i/o filters and IF snippet dont work within a chunk using getResources.

                I can get the date from a TV or from a snippet - It is equal. The problem with the IF or i/o filters will be still there.
                  • 8694
                  • 61 Posts
                  Here are the news!

                  I try this:
                  [[!If?
                  &subject=`[[+nbofdays]]`
                  &operator=`lt`
                  &operand=`7`
                  &then=`[[$tplStatusBnew]]`
                  &else=`[[$tplStatusB]]`
                  ]]
                  [[+id]]


                  The last [[+id]] was only for testing. So I see that the IDs was list correctly. But the output is equal with the first document.

                  That ist the output chunk (tplStatusB)
                  <div class="box">
                       <a class="pop" href="[[~[[+id]]]]">
                            <img src="[[+tv.cover]]" width="100" height="141" /><br /><br />
                            <strong>[[+tv.firma]]</strong><br />[[+tv.beschreibung]]
                       </a>
                  </div>
                    • 8694
                    • 61 Posts
                    Soooo. I am just getting freak out about Revo!!!

                    I found the solution for this problem.
                    I write like e.g. &then=`[[$chunkname]] and &else=`[[$chunkname2]] and we know that thing did not work.
                    So I just in case wrote not &then=`[[$chunkname]],
                    I worte &then=` <div....the complete chunk HTML incl. placeholder etc. `
                    The same withe the &else parameter.
                    So and this will work!!!

                    But why? And where I can read about that I can not use chunks in chunks or whatever?
                      • 28042 ☆ A M B ☆
                      • 24,524 Posts
                      You would have to actually somehow output the chunk tags. A snippet is PHP code; PHP doesn’t understand MODx tags. Doesn’t Revo have an equivalent to $modx->getChunk() and $modx->parseChunk()?
                        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