We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 53722
    • 13 Posts
    I am trying to set up an operator to unpublish some items when their unpublish date is up, but the where operator seems to be always returning false. Here is a test:

    [[!getImageList?
    &tvname=`HeaderTV`
    &tpl=`BannerSliderElementMIGX`
    &where='{"5:=":"5"}'
    ]]

    That unpublishes everything, seems like the where statement is returning false.

    Note that this is just for a test. I have tried this with my actual TVs and chunks and no matter what I put in the where field, everything gets unpublished.

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

      • 4172
      • 5,888 Posts
      backtics instead of single-quotes?
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 53722
        • 13 Posts
        Quote from: Bruno17 at Aug 29, 2017, 09:00 PM
        backtics instead of single-quotes?

        Sorry, that was a bad copy and paste. I have used back-ticks in my actual code yes. I am using the quotes so that it will actually render the TVs (as a way to break that part of the code but still have it there, should probably just use comments)
          • 4172
          • 5,888 Posts
          what is your snippet-call, where you are trying to hide the unpublished items?

          and what is the output, which you get with:

          [[getImageList?
          &tvname=`HeaderTV`
          ]]
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 53722
            • 13 Posts
            getimagelist:

            Array
            (
            [MIGX_id] => 1
            [image] => sites/bow/media/banners/Antelope_NewWeb-01.jpg
            [image_link] => --
            [image_alt_text] =>
            [unpublishdate] => 2017-08-31 13:32:00
            [butt1] =>
            [butt1url] => --
            [_alt] => 0
            [_first] => 1
            [_last] =>
            [idx] => 1
            [property.tvname] => HeaderTV
            )
            Array
            (
            [MIGX_id] => 2
            [image] => sites/bow/media/banners/Gale_NewWeb-01.jpg
            [image_link] => --
            [image_alt_text] =>
            [unpublishdate] => 2017-08-31 13:32:00
            [butt1] =>
            [butt1url] => --
            [_alt] => 1
            [_first] =>
            [_last] =>
            [idx] => 2
            [property.tvname] => HeaderTV
            )
            Array
            (
            [MIGX_id] => 3
            [image] => sites/bow/media/banners/Hoopla_NewWeb-01.jpg
            [image_link] => --
            [image_alt_text] =>
            [unpublishdate] => 2017-08-31 13:32:00
            [butt1] =>
            [butt1url] => --
            [_alt] => 0
            [_first] =>
            [_last] => 1
            [idx] => 3
            [property.tvname] => HeaderTV
            )


            snippet for comparing:

            <?php
            return strftime('%Y-%m-%d 00:00:00');

            snippet is titled today_date
              • 4172
              • 5,888 Posts
              and your getImageList - snippet-call?
                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
                • 53722
                • 13 Posts
                Not sure I understand the question. The first post with

                [[!getImageList?
                &tvname=`HeaderTV`
                &tpl=`BannerSliderElementMIGX`
                &where=`{"5:=":"5"}`
                ]]

                Is on the page where I use getimagelist. It works if I omit the &where tag. The above is just a testing example though (that doesn't work). The actual one I want to use is:

                [[!getImageList?
                &tvname=`HeaderTV`
                &tpl=`BannerSliderElementMIGX`
                &where=`{"unpublishdate:>":"[[!today_date]]"}`
                ]] [ed. note: aarond last edited this post 7 years, 2 months ago.]
                  • 4172
                  • 5,888 Posts
                  For testing, I tried this:

                  [[!getImageList?
                  &value=`[{"MIGX_id":"1","unpublishdate":"2017-08-30 13:32:00"},{"MIGX_id":"2","unpublishdate":"2017-09-02 13:32:00"},{"MIGX_id":"3","unpublishdate":"2017-09-03 13:32:00"},{"MIGX_id":"4","unpublishdate":"2017-08-20 13:32:00"}]`
                  &where=`{"unpublishdate:>":"[[!today_date]]"}`
                  ]]
                  


                  and that's working for me. Which Version of MIGX are you at?
                    -------------------------------

                    you can buy me a beer, if you like MIGX

                    http://webcmsolutions.de/migx.html

                    Thanks!
                    • 53722
                    • 13 Posts
                    2.11.0.

                    The snippet you provided won't work for me in a live environment, however. This migx template variable that were are calling is accessable to content creators in order to add rotating banners on a slider, it won't always have a static number of things in the array.
                      • 4172
                      • 5,888 Posts
                      For Testing, it is enough, to give getImageList a value like that.
                      That's the same, as you would give a tvname with the name of your MIGX-TV, actually.

                      See, what you get with

                      [[*HeaderTV]]


                      and post it here. Then, I can test against your items on my end.
                        -------------------------------

                        you can buy me a beer, if you like MIGX

                        http://webcmsolutions.de/migx.html

                        Thanks!