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

    I use Cliche components with MODx 2.2.6
    Is there a way to select the albums to display?
    I thought spend a list of ids in parameters.
    Is it possible?

    Thank you in advance
      • 42625
      • 9 Posts
      I answer to myself, maybe the solution can be used for other

      I created a snippet that iterates through a list of id (id1, id2, id3) and displays the corresponding albums.

      It is called like that :
      [[displayClicheAlbums? &listAlbums=`1,2,3` &wrapperTpl=`` &itemTpl=`` &height=`` &width=``]]

      height and width are optional

      Snippet code is :
      <?php
      $idAlbums = explode(",", $listAlbums);
      
      if (!isset($width)) $width = 280;
      if (!isset($height)) $height = 100;
      
      $output= "";
      
      foreach ($idAlbums as $idAlbum) { 
          
          $output .= $modx->runSnippet('Cliche',array(
              'id' => $idAlbum,
              'view'=>'album',
              'thumbWidth'=>$width,
              'thumbHeight'=>$height,
              'wrapperTpl' => $wrapperTpl,
              'itemTpl'=> $itemTpl,
              'columns' => '0',
              'loadJquery'=>'0'
          ));
      }
      
      return $output;