[РЕШЕНО] Зациклить пейджер

Главные вкладки

Аватар пользователя Andrey Zakharov Andrey Zakharov 24 ноября 2010 в 13:46

Есть ли возможность (модулем, сниппетом) зациклить в луп пейджер от Views (mini pager)
То есть чтобы на первой странице можно было пойти назад и попасть на посл. страницу.
И аналогично на последней пойти вперед и попасть на первую?

Комментарии

Аватар пользователя Andrey Zakharov Andrey Zakharov 6 декабря 2010 в 17:43

Находим в views/theme/theme.inc функцию
theme_views_mini_pager
и копируем себе в template.php под соответсвующим именем THEMENAME_views_mini_pager
Заменяем те строчки где стоит ' ' theme( 'pager_last', ... ) и theme( 'pager_next', ... )

<?php
function spera_views_mini_pager$tags = array(), $limit 10$element 0$parameters = array(), $quantity ) {
  global 
$pager_page_array$pager_total;

  

// Calculate various markers within this pager piece:
  // Middle is used to "center" pages around the current page.
  
$pager_middle ceil($quantity 2);
  
// current is the page we are currently paged to
  
$pager_current $pager_page_array[$element] + 1;
  
// max is the maximum page number
  
$pager_max $pager_total[$element];
  
// End of marker calculations.

  

$li_previous theme('pager_previous', (isset($tags[1]) ? $tags[1] : t('prev')), $limit$element1$parameters);

  if (empty(

$li_previous)) {/* HERE CUSTOMIZE */
    
$li_previous theme('pager_last'$text$limit$element$parameters);
  }
/* END CUSTOMIZE */

  

$li_next theme('pager_next', (isset($tags[3]) ? $tags[3] : t('next')), $limit$element1$parameters);

  if (empty(

$li_next)) {/* HERE CUSTOMIZE */
    
$li_next theme('pager_first'$text$limit$element$parameters);
  }
/* END CUSTOMIZE */

  

if ($pager_total[$element] > 1) {
    
$items[] = array(
      
'class' => 'pager-previous',
      
'data' => $li_previous,
    );

    

$items[] = array(
      
'class' => 'pager-next',
      
'data' => $li_next,
    );
    return 
theme('item_list'$itemsNULL'ul', array('class' => 'pager'));
  }
}
?>