title: Smarty loop stops after 1
body: <p>i'm editing a website in smarty. I got that code which works for gallery, however it displays only 1 image per page... How can it be there is no limitation in any loop. I dont know well smarty think, cud any1 help me with that one ? </p>
  
  <pre><code>&lt;div class="galleryConteiner"&gt;
  &lt;h1&gt;{$gallery.gallery.desc.title}&lt;/h1&gt;
  &lt;div class="text"&gt;{$gallery.gallery.desc.description}&lt;/div&gt;
  &lt;div class="imagesConteiner"&gt;
      {foreach from=$gallery.gallery.images item=image name=gallery_loop}
          {if $image.type == "image"}  
            &lt;a class="galleryThumb" href="{$image.image_link}" rel="lightbox[gallery]"&gt;
              &lt;img src="{$image.thumb_link}" /&gt;
              {if $image.title}&lt;span class="imageCaption"&gt;{$image.title}&lt;/span&gt;{/if}
            &lt;/a&gt;
          {elseif $image.type == "film" || $image.type == "youtube_film" || $image.type == "vimeo_film"}
            &lt;a href="{$image.url}"&gt;&lt;img src="{$image.remote_thumb}"/&gt;&lt;/a&gt;
          {elseif $image.type == "uploaded_film"}
              &lt;a href="{$image.url}"&gt;&lt;img src="{$image.thumb_link}" /&gt;&lt;/a&gt;
          {/if}   
  
      {/foreach}
      &lt;div class="clearFix"&gt;&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p>I guess this is php file responsible for that gallery </p>
  
  <pre><code>  &lt;?php
  
    require_once( dirname( __FILE__ ).'/../../libs/class/mtGalleryDAO.php' );
    require_once( dirname( __FILE__ ).'/../../libs/class/mtsPager.php' );
    require_once( dirname( __FILE__ ).'/../../libs/class/mtTreesDAO.php' );
    require_once( dirname( __FILE__ ).'/../../libs/class/mtAdditionalMenuDAO.php' );
  
  
    mtGalleryDAO::$pid = $__MOD_ENVIROMENT[ 'pid' ];
  
    $mtConf = mtConfigurationManager::getInstance();
    $configPrefix = "cms.module.$__MOD_NAME.$__MOD_EVENT.$__MOD_RUN.";
  
    $skip_request = $mtConf-&gt;getValue( $configPrefix.'skip_request', 0 );
    $output_context = $mtConf-&gt;getValue( $configPrefix.'output_context', 'gallery' );
     $default_action = $mtConf-&gt;getValue( $configPrefix.'action', 'show' );
   $default_id = $mtConf-&gt;getValue( $configPrefix.'id' , 0 );
   $default_category = $mtConf-&gt;getValue( $configPrefix.'category' , 0 );
     $page_size = $mtConf-&gt;getValue( $configPrefix.'page_size' , 10 );
   $page_size_gallery = $mtConf-&gt;getValue( $configPrefix.'page_size_gallery' , 1000 );
   $action = ( $skip_request ) ? $default_action : $__MOD_ENVIROMENT[ 'action' ] ; 
   $id = ( $skip_request ) ? $default_id : $__MOD_ENVIROMENT[ 'params' ][ 'id' ];
    $result = array();
    switch( $action )
    {
    case 'show':
      $page = ( !empty( $__MOD_ENVIROMENT[ 'params' ][ 'page' ] ) ) ? $__MOD_ENVIROMENT[ 'params' ][ 'page' ] : 1 ;
  
      $result[ 'gallery' ] = mtGalleryDAO::getGalleryFullInfo( $id , true , $page, $page_size);
      $result[ 'pagination' ] = mtsPager::pagination( $page, $page_size, mtGalleryDAO::countGalleryImages( $id , true ));
  
      $result[ 'next' ] = mtGalleryDAO::getNextGallery($id);
      $result[ 'prev' ] = mtGalleryDAO::getPrevGallery($id);        
  
      $id = isset($result[ 'gallery' ]['images'][0]['id'])?(int)$result[ 'gallery' ]['images'][0]['id']:null;
      $sid = isset($result[ 'gallery' ]['desc']['sid'])?(int)$result[ 'gallery' ]['desc']['sid']:null;
  
      mtSeoManager::getSeoData(&amp;$result, $sid, $__MOD_ENVIROMENT[ 'pid' ]);
  
      if (mtRedirecter::isFound($configPrefix ,$id, $output_context, $result))
          mtRedirecter::checkRedirect($sid,$__MOD_ENVIROMENT[ 'pid' ],'g'.$id);
      break;
  case 'image':                        
      $result[ 'image' ][ 'currentImage' ] = mtGalleryDAO::getImageShortInfo( $__MOD_ENVIROMENT[ 'params' ][ 'id' ] );
  
      $id = isset($result[ 'image' ][ 'currentImage' ]['id'])?(int)$result[ 'image' ][ 'currentImage' ]['id']:null;
      $sid = isset($result[ 'image' ][ 'currentImage' ]['sid'])?(int)$result[ 'image' ][ 'currentImage' ]['sid']:null;
  
      mtSeoManager::getSeoData(&amp;$result, $sid, $__MOD_ENVIROMENT[ 'pid' ]);
  
      if (mtRedirecter::isFound($configPrefix ,$id, $output_context, $result))
      {
          mtRedirecter::checkRedirect($sid,$__MOD_ENVIROMENT[ 'pid' ],'i'.$id);           
  
          $prevId = mtGalleryDAO::prevImageId( $__MOD_ENVIROMENT[ 'params' ][ 'id' ], true ); 
          if( $prevId &gt; 0 )
              $result[ 'image' ][ 'prevImage' ] = mtGalleryDAO::getImageShortInfo( $prevId );
          $nextId = mtGalleryDAO::nextImageId( $__MOD_ENVIROMENT[ 'params' ][ 'id' ], true ); 
          if( $nextId &gt; 0 )
              $result[ 'image' ][ 'nextImage' ] = mtGalleryDAO::getImageShortInfo( $nextId );            
          $result[ 'image' ][ 'gallery' ] = mtGalleryDAO::getGalleryShortInfo( $result[ 'image' ][ 'currentImage' ][ 'gallery_id' ] );
      }
      break;
  case 'list':        
      if (!isset($__MOD_ENVIROMENT['params']['page']) || $__MOD_ENVIROMENT['params']['page'] == 0)
          $page = 1;
      else
          $page = $__MOD_ENVIROMENT['params']['page'];
  
      $result = array();
  
      $result[ 'page' ] = $page;
      $result[ 'page_number' ] = mtGalleryDAO::listGalleryPageNumber( $__MOD_ENVIROMENT[ 'params' ][ 'category_id' ] , $page_size, true); 
  
      //paginacja:
      $result[ 'pagination' ] = array();
      if ($page &gt; 0)
      {
      $result[ 'prev' ] = $page - 1;
      if (!isset($__MOD_ENVIROMENT['params']['page']) || $__MOD_ENVIROMENT['params']['page'] == 0)
          $result[ 'prev_url'] = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].',page='.$result['prev'];
      else
          $result[ 'prev_url'] = 'http://'.$_SERVER['HTTP_HOST'].substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'],'page=')).'page='.$result['prev'];
      }        
      if ($page &lt; $result[ 'page_number' ])
      {
              $result[ 'next' ] = $page + 1;
      if (!isset($__MOD_ENVIROMENT['params']['page']) || $__MOD_ENVIROMENT['params']['page'] == 0)
          $result[ 'next_url'] = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].',page='.$result['next'];
      else
          $result[ 'next_url'] = 'http://'.$_SERVER['HTTP_HOST'].substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'],'page=')).'page='.$result['next'];
      }
  
      //$pagination_counter =  mtGalleryDAO::getGalleryPaginationCounter( $__MOD_ENVIROMENT[ 'params' ][ 'category_id' ]) ;
  
      for ($i = 1; $i&lt;= $result[ 'page_number' ]; $i++)
      {
      if (!isset($__MOD_ENVIROMENT['params']['page']) || $__MOD_ENVIROMENT['params']['page'] == 0)
              $result[ 'pagination' ][] = array(
                  'url' =&gt; 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].',page='.$i,
                  'selected' =&gt; $page == $i,
              );
      else
              $result[ 'pagination' ][] = array(
                  'url' =&gt; 'http://'.$_SERVER['HTTP_HOST'].substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'],'page=')).'page='.$i,
                  'selected' =&gt; $page == $i,
              );
      }
  
      $result[ 'galleries' ] = mtGalleryDAO::listGallery( $__MOD_ENVIROMENT[ 'params' ][ 'category_id' ] , $page -1, $page_size, true);                
  
  foreach ( $result[ 'galleries' ] as $key =&gt; $gallery )
  {
      $result[ 'galleries' ][ $key ][ 'images' ] = mtGalleryDAO::getGalleryImages( $gallery[ 'id' ], true );
  }
  
      $additional_menu = mtAdditionalMenuDAO::getByItemAndModule($__MOD_ENVIROMENT[ 'params' ][ 'category_id' ], mtAdditionalMenuType::GALLERY_CATEGORY, $__MOD_ENVIROMENT[ 'pid' ]);
  
      if(isset($additional_menu[0]['menu_id'])){
          $result[ 'additional_menu' ] = $additional_menu[0];
          $result[ 'additional_menu_tree' ] = mtTreesDAO::getTemplateTree((int)$additional_menu[0]['menu_id']);
      }
  
      break;
  case 'latestImages':
      $number_of_latest_images    = $mtConf-&gt;getValue( $configPrefix.'number_of_latest_images' , 10 );
      $category_id                = $mtConf-&gt;getValue( $configPrefix.'category_id' , 0 );
  
      $result[ 'images' ] = mtGalleryDAO::latestImages( $number_of_latest_images, $category_id);
  break;
  
  case 'randomImages':
      $page_size      = $mtConf-&gt;getValue( $configPrefix.'page_size' , 10 );
      $category_id    = $mtConf-&gt;getValue( $configPrefix.'category_id' , 0 );
  
      $result[ 'images' ] = mtGalleryDAO::randomImages( $page_size, $category_id);
  break;
  }
  
    $__MOD_RESULT = $result;
   $__MOD_OUTPUT_CONTEXT = $output_context;
  
    ?&gt;
  </code></pre>