We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 53148
    • 7 Posts
    I want to check whether TV INSIDE MIGX (not the TV with type of MIGX, but the TV, which I define in JSON config) is empty, and show/hide a block inside the output depended on the result.

    Let's assume I have a field.
            {
                "field": "title",
                "caption": "Title"
            }
    


    Inside
    getImageList
    call I'm checking if the input is filled.
    [[getImageList?
            &tvname=`MIGXTV`
            &tpl=`@CODE:
                     [[!if?
                            &subject=`[[+title]]`
                            &operator=`is`
                            &operand=``
                            &then=`Empty`
                            &else=`Filled`
                      ]]
            `
    ]]
    


    But this doesn't work, I always get "Filled" regardless of the real value.

    This check also doesn't work
    [[!if?
             &subject=`[[+title]]`
            &operator=`is`
            &operand=`[]`
            &then=`Empty`
            &else=`Filled`
    ]]
    


    The field is not even equal to itself. The next check returns "Not equal"
    [[!if?
             &subject=`[[+title]]`
            &operator=`eq`
            &operand=`[[+title]]`
            &then=`Equal`
            &else=`Not equal`
    ]]
    


    What I'm doing wrong here?

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

    • discuss.answer
      • 52064
      • 120 Posts
      creates a real chunk for the tpl.
      The tpl in CODE only replace the placeholder but does not execute snippets.

      if you look at the source https://github.com/Bruno17/MIGX/blob/master/core/components/migx/elements/snippets/getimagelist.snippet.php
      you also have the where parameter !


        FerX - Developer at Eracom s.r.l.
        • 53148
        • 7 Posts
        Quote from: ferx77 at Jun 16, 2018, 07:35 AM

        you also have the where parameter !

        Thanks! WHERE is the exact thing I was looking for! Moving template to chunk also worked, but it's strange, because I had tried that before with no luck