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

    I use a migx image Tv in a getResources call (using getImageList), but it just output the first image of each resource multiple times...

    GetResources Call
    <ul id="news">
       [[!getResources? &parents=`1091` &tpl=`news-web` &sortby=`menuindex` &limit=`20` &includeTVs=`1` &processTVs=`1` &showUnpublished=`0` &showHidden=`1` ]]
    </ul>
    


    GetResources tpl (news-web)
    <li class="news-item news-[[+idx]]">
      [[!getImageList? &tvname=`imagesNews` &tpl=`news-image-web` &docid=`[[+id]]`]]
    </li>
    


    getImageList tpl (news-image-web)
    <img class="image-news [[+id]] [[+idx]]" width="900" height="345" title="[[+longtitle]]" src="[[+image]]" />
    


    For exemple when getresources outputs the first resource wich has 3 images, the [[+id]], [[+longtitle]] of the resource are correctly populated, the [[+image]] always returns the first image and [[+idx]] is correctly incremented...

    I really don't know what I'm doing wrong... help would be greatly appreciated!!

    Output exemple:
    <li class="news-item news-1">
      <img class="image-news 1117 1" title="My Resource title" src="assets/image/news/image1.jpg" height="345" width="900">
      <img class="image-news 1117 2" title="My Resource title" src="assets/image/news/image1.jpg" height="345" width="900">
      <img class="image-news 1117 3" title="My Resource title" src="assets/image/news/image1.jpg" height="345" width="900">
    </li>
    
      • 4172
      • 5,888 Posts
      try to call getResources and getImageList cached, there is no reason to call them uncached here, is it?

      [[getResources


      [[getImageList


      may be you will need to pass the resource-fields to getImageList then:

      [[getImageList? &longtitle=`[[+longtitle]]`


      and use it in news-image-web like that:

      <img class="image-news [[+property.docid]] [[+idx]]" width="900" height="345" title="[[+property.longtitle]]" src="[[+image]]" />





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

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 21135
        • 8 Posts
        Thank you Bruno17,

        I tried to uncache cache the getResources and getImageList but I still have the same problem... which is that it is the [[+image]] field that is not updated. GetImageList seems to loop for the correct number of images in the migx tv, but always output the value of the first image.

        Also what may be odd is that I don't need to have to pass the getResourses values to use them in my getImageList template, using them directly works as well (I tried both ways and they both work well). Still the pb is with the migx tv not the other tvs...

        Just for the example:
        What it outputs:
        <li class="news-item news-1">
          <img class="image-news 1117 1" title="My Resource title" src="1.jpg">
          <img class="image-news 1117 2" title="My Resource title" src="1.jpg">
          <img class="image-news 1117 3" title="My Resource title" src="1.jpg">
        </li>
        

        What It "should" ouput:
        <li class="news-item news-1">
          <img class="image-news 1117 1" title="My Resource title" src="1.jpg">
          <img class="image-news 1117 2" title="My Resource title" src="2.jpg">
          <img class="image-news 1117 3" title="My Resource title" src="3.jpg">
        </li>
        


          • 4172
          • 5,888 Posts
          Do you have or had the TV used for the 'image' - field assigned to your resource-template?
          This can be the issue.

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

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 21135
            • 8 Posts
            Thank you Bruno17!

            Yes the Migx Tv is assigned to the template, but It use an old image tv as the "inputTV" which was also assigned to that same template, and even though I had it removed from the template, its old values were still overiding those of the migx tv (not sure if it's clear!).

            I find it is strange since in the db the correct tvs were assigned to the correct templates... the solution was just to remove the entries with my old tv id in the site_tmplvar_contentvalues table, and now it's working perfectly.

            Again thank you very much! Your help was greatly appreciated!