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

    After reading this post: https://forums.modx.com/thread/80762/getimagelist-used-in-getresources-rowtpl-only-shows-data-from-first-item

    having a similar problem, I'm not able to make my stuff running again right.
    Always some cache/uncached parsing issues.

    I discovered recently that the output of a getResource (listing all sub pages of the current one) and for each row (sub page) calling its migx tv content with getimagelist, did not work correctly anymore (since when, what update of Modx?..no idea.. anyway)

    I switch to PDO resource instead of Getressource.
    here's the getImageList call:
    [[!getImageList?
            &tvname=`FichiersDoc`
            &tpl=`ListeFilesTpl`
            &docid=`[[BabelTranslation? &contextKey=`[[*context_key]]` &resourceId=`[[+id]]` ]]`
            &randomize=`0`
    	&toPlaceholder=`rawDocList[[+idx]]`
            ]]

    and managed to get a different footprint for each row, like in the indicated thread upthere:
    [[[[!+rawDocList[[+idx]]:notempty=`!+rawDocList[[+idx]]`]]]]


    This works.
    How ever I'd like to display this list, and its wrapping ONLY when there something. I tried different flavors of the inner test, but none of them works.
    here's one of my tried.
     [[[[!+rawDocList[[+idx]]:notempty=`$WithDocList`]]]]                  
     [[[[!+rawDocList[[+idx]]:isempty=`$NoDocList`]]]] 
    
    Such attempt always behave like the list is not empty (fire the $WithDocList for all rows) but returns an empty list each time.
    
    here's $WithDocList:
       		
    <div class="span8 WithDoclist" >
    [[+content]]
    </div>
    <div class="span4 well fond-beige" id="docfiles">
    [[- list pdf of this brand block ]]
    <h4 class="">Documentation</h4><hr class="separh" />
    <ul>
    [[!+rawDocList[[+idx]]]]
    </ul>
    </div>

    I dont see the issue ..why calling chunk depending on the getimagelist placeholder is empty or not gives erratic returns

    Thanks
      • 36604
      • 268 Posts

      I found some other clue here: https://forums.modx.com/thread/?thread=29952&page=2

      Not that clear, but with the following code, the placeholder parsing gives now good results wether it's empty or not:

      <div class="row-fluid doc2" id="mc[[+id]]">                       
         			
      		[[!+rawDocList[[+idx]]:is=``:then=`
      <div class="span8 WithDoclist" >  
       [[+content]]
      </div>
      `:else=`
      <div class="span8 WithDoclist" >  
       [[+content]]
      </div>
      <div class="span4 well fond-beige" id="docfiles">
      [[- list pdf of this brand block ]]
          <h4 class="">Documentation</h4><hr class="separh" />
          <ul>
          [[!+rawDocList[[+idx]]]]
          </ul>
      </div>
      `
      ]]
      
       </div>