We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24629
    • 370 Posts
    Hi.
    I noticed that when i create a resource based on a template with a MIGX TV, that the contentvalue of the TV is initialy []. (in prefix_site_tmplvar_contentvalues)
    This is pretty annoying since i'm also using the :notempty filter.
    Only when i enter a value in the TV and then remove that value is the contentvalue empty.
    Can the initial contentvalue for a MIGX TV be really empty please for a newly created resource?

    RDG
      • 36930
      • 22 Posts
      I just ran into this after updating to 2.2.13.

      I got around my previous notempty filter by using:
      [[*tvname:is=`[]`:then=``:else` "my code plus getImageList" `]]


      There might be a better way, but this got my conditional tv's back to working the way they were.
        • 4172
        • 5,888 Posts
        An empty MIGX - TV can be either really empty like

        ''

        or an empty json-array like

        []


        To get sure the test for an empty output is getting the correct result, you can use the &toPlaceholder - property like:

        [[getImageList?
        &tvname=`yourTV`
        &tpl=`yourTpl`
        &toPlaceholder=`migxoutput`
        ]]
        
        [[+migxoutput:isnot=``:then=`[[+migxoutput]]`:else=``]]
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 24629
          • 370 Posts
          But why is the initial value an '[]' instead of ''?
          seems so unnessecary

          and it took me a while before i figured out what was going on because it is so illogical.

          RDG
            • 4172
            • 5,888 Posts
            its very logical, MIGX does output an array as json-string and an empty array is: []
            It can be empty initially, when no value was added at all, but as soon as you empty an array the result is []

            May be, I should work on that, but this can take a while.
            I, for myself, I'm ok with that so far.
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!