We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 50574
    • 70 Posts
    Hello

    I have a page with a few getImageList calls on it and for one of them I'd like to get the total items to be able to then=`` and else=`` the div that contains a getImageList call. I'm using a custom totalVar which is called and hidden within the tpl then, outside of the getImageList I'm asking if it isequalto=`1` do this else do this but it doesn't seem to be working.

    gatImageList call
    <div [[+ticker-total:is=`1`:then=`class="newsTicker"`:else=`class="newsTicker owl-carousel"`]]>
    [[!getImageList?
    &tvname=`tickerNews`
    &tpl=`tickerTpl`
    &totalVar=`ticker-total`]]
    </div>

    tickerTpl chunk
    <p><span class="hidden">[[+ticker-total]]</span><span class="greyText">Latest News:</span> [[+ticker-link:isnot=``:then=`<a href="[[+ticker-link]]">[[+headline]]</a>`:else=`[[+headline]]`]]</p>


    Any thoughts?

    Thanks in advance.
      • 4172
      • 5,888 Posts
      call it uncached and maybe before you need the placeholder, like this:
      [[getImageList?
      &tvname=`tickerNews`
      &tpl=`tickerTpl`
      &totalVar=`ticker-total`
      &toPlaceholder=`tickerNews`
      ]]
      <div [[+ticker-total:is=`1`:then=`class="newsTicker"`:else=`class="newsTicker owl-carousel"`]]>
      [[+tickerNews]]
      </div>


      you can also try to use a wrapperTpl for the outer - code

      [[getImageList?
      &tvname=`tickerNews`
      &tpl=`tickerTpl`
      &totalVar=`ticker-total`
      &wrapperTpl=`tickerWrapperTpl`
      ]]


      and the tickerWrapperTpl

      <div [[+ticker-total:is=`1`:then=`class="newsTicker"`:else=`class="newsTicker owl-carousel"`]]>
      [[+output]]
      </div>
      

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

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 50574
        • 70 Posts
        Perfect Bruno, the wrapperTpl did the trick.
        Might be worth adding it to the frontend properties rtfm?

        Thanks