We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 46971
    • 33 Posts
    I want two different outputs, one for the case the MigX TV is not empty and another for the situation the MigX TV is empty.

    So i build up the following getResource-Code:

    [[getResources?
    &parents=`17`
    &tpl=`footer-projekte-tpl`
    &includeContent=`1`
    &includeTVs=`1`
    &processTVs=`1`
    &depth=`0`
    &limit=`6`
    &showUnpublished=`0`
    &showHidden=`1`
    &sortby=`{"menuindex":"ASC"}`
    ]]
    


    And the following footer-projekte-tpl (better code-solutions related to the input/output filters are welcome):
    [[*migx-projekt-items:isnot=``:then=`
    <li>
        <a href="[[!++site_url]][[*uri]]" title="Projekt [[+longtitle]]">
            [[+longtitle]]
        </a>
    </li>
    `]] 
    [[*migx-projekt-items:is=``:then=`
    <li class="grey">
        [[+longtitle]]
    </li>
    `]] 
    


    But that does not work. I always get the second output without any link, although on some sites/projects the migx is filled in (and others are not). Can I make such a condition, to relate it to a migx TV? Help smiley

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

    • discuss.answer
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      You could try it using the :else=`` in the first output modifier, instead of using two output modifiers. Also be careful, you're using resource TV tags [[*...]] where you should probably be using placeholder tags [[+...]]

      See an explanation here http://modxcookbook.com/add-ons/menus/ (this applies to any listing snippets that use tpls).
        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
        • 46971
        • 33 Posts
        Ok, changed the tags to placeholder tags. Thx. Now i've added the :else ...but it does not change anything in the output, though it's a nicer code. Still only get no links.

        Important: the "[[+migx-projekt-items]]" is no normal tv used in any migx - but it is a migx tv itself. Can i relate any condition to a migx-tv? And also: i have no getImageList anywhere related to this chunk-tpl.. so maybe the chunk does not even know what "[[+migx-projekt-items]]" is?

        Maybe can i tell "getresource" to include migx(Tvs)?
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Now that made my head hurt!

          getImageList is used to output the list of items in a MIGX TV.

          If you have MIGX TVs for each of the resources listed in your getResources call, then you'd need a getImageList in the getResources chunk tpl.

          But I can't figure out what exactly you have and what you are trying to do with it.
            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
            • 46971
            • 33 Posts
            Okay, i just noticed, there must be a big fault.

            The situation: I have project resources/sites in my resource tree. These projects have the migx TV contained. If the migx TV is not empty for one resource, i want these project named in the footer with a link to it. But if the migx is empty, it should also be mentioned - but without any link to the project site.

            So i thought to relate this condition to the migx tv - if it is empty for the resource or not. But the getImageList is only on the project site. I have no getImageList for the footer (that is on every site, not only on project sites), for example.

            It is soo complex and complicated for me as a beginner.
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              A MIGX TV stores its data as a JSON string in the same field that any TV stores its value.

              So this should work:
              [[+migx-projekt-items:isnot=``:then=`
              <li>
                  <a href="[[!++site_url]][[+uri]]" title="Projekt [[+longtitle]]">
                      [[+longtitle]]
                  </a>
              </li>
              `:else=`
              <li class="grey">
                  [[+longtitle]]
              </li>
              `]] 


                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
                • 46971
                • 33 Posts
                That does not work. But any other TV does not work, too. I don't understand why.
                It works, when i relate it to "+hidemenu":

                [[+hidemenu:isnot=``:then=`
                <li class="grey">
                    [[+longtitle]]
                </li>
                `:else=`
                <li>
                    <a href="[[!++site_url]][[+uri]]" title="">
                        [[+longtitle]]
                    </a>
                </li>
                `]]
                


                But it does not work, when i relate it to any tv like a new tv called [[+hiddenInFooter]]. Though i have the options "includeTVs" in the getresource call (as in the first post).
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  I would need to see what you have in order to do any more. I'm just guessing since I don't know what you have.
                    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
                  • discuss.answer
                    • 4172
                    • 5,888 Posts
                    TVs have a tvPrefix of tv. by default, if you are inside a getResources-tpl
                      -------------------------------

                      you can buy me a beer, if you like MIGX

                      http://webcmsolutions.de/migx.html

                      Thanks!
                      • 46971
                      • 33 Posts
                      Omg, of course! That's it bruno. And now it also works with the migx-tv itself.
                      Thank you both!!