We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 53722
    • 13 Posts
    Alright I had to change my testing environment a bit as that website is going live, but its a problem on all sites. The new testing environment has 1 less migx_id currently. That being said:

    The code in reply#8 does not work, even with my removal of migx_id4 from the syntax.

    [[*HeaderTV]] gives me this:

    [{"MIGX_id":"1","image":"banners/Antelope_NewWeb-01.jpg","image_link":"","image_alt_text":"","unpublishdate":"","butt1":"","butt1url":"--"},{"MIGX_id":"2","image":"banners/Gale_NewWeb-01.jpg","image_link":"","image_alt_text":"","butt1":"","butt1url":"","butt2":"","butt2url":""},{"MIGX_id":"3","image":"banners/Hoopla_NewWeb-01.jpg","image_link":"","image_alt_text":"","butt1":"","butt1url":"","butt2":"","butt2url":""}]
    

    Here is the code from my banner_test chunk(where the variable call resides):

    <div class="kode-banner" style="z-index: -1;">
        <div class="bxslider">
            <div class="swiper-container-slider">
                <!-- Additional required wrapper -->
                <div class="swiper-wrapper">
                    <!-- Slides -->
                    [[*HeaderTV:is=null:then=`
                        <div class="swiper-slide"><img src="sites/common/media/banner/med_hat_library08.jpg" alt="Shortgrass Library System"></div>
                    `:else=`
                            [[!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"}]`
                                &where=`{"unpublishdate:>":"[[!today_date]]"}`
                            ]]
                          [[*HeaderTV]]
                    `]]
                </div>
    
    
                <!-- If we need pagination -->
                <div class="swiper-pagination"></div>
            </div>
        </div>
    </div>
      • 4172
      • 5,888 Posts
      [{"MIGX_id":"1","image":"banners/Antelope_NewWeb-01.jpg","image_link":"","image_alt_text":"","unpublishdate":"","butt1":"","butt1url":"--"},{"MIGX_id":"2","image":"banners/Gale_NewWeb-01.jpg","image_link":"","image_alt_text":"","butt1":"","butt1url":"","butt2":"","butt2url":""},{"MIGX_id":"3","image":"banners/Hoopla_NewWeb-01.jpg","image_link":"","image_alt_text":"","butt1":"","butt1url":"","butt2":"","butt2url":""}]
      


      seems there isn't a unpublishdate, only the first item has a unpublishdate, but this is empty?
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
      • discuss.answer
        • 4172
        • 5,888 Posts
        and I would do it this way:

                                [[!getImageList?
                                    &tvname=`HeaderTV`
                                    &tpl=`BannerSliderElementMIGX`
                                    &where=`{"unpublishdate:>":"[[!today_date]]"}`
                                    &emptyTpl=`@CODE:<div class="swiper-slide"><img src="sites/common/media/banner/med_hat_library08.jpg" alt="Shortgrass Library System"></div>`
                                ]]

          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 53722
          • 13 Posts
          Quote from: Bruno17 at Sep 01, 2017, 05:45 PM
          and I would do it this way:

                                  [[!getImageList?
                                      &tvname=`HeaderTV`
                                      &tpl=`BannerSliderElementMIGX`
                                      &where=`{"unpublishdate:>":"[[!today_date]]"}`
                                      &emptyTpl=`@CODE:<div class="swiper-slide"><img src="sites/common/media/banner/med_hat_library08.jpg" alt="Shortgrass Library System"></div>`
                                  ]]


          Would you use this in place of the entire if/else statement?
            • 4172
            • 5,888 Posts
            yes, this would output the emptyTpl - Code, if there are no results.

            Try not to use conditionals, if there are other/better solutions.
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
              • 53722
              • 13 Posts
              Excellent. That seems to work for me. I removed it out of the conditional and its working nicely. Thank you!