Темизация Paging

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

Аватар пользователя man-1982 man-1982 6 декабря 2009 в 23:39

Здравствуйте! Подскажите как темезировать модуль Paging. Требуется сделать на страничке только кнопки вперед и назад, причем в виде картинок. Заранее спасибо. Только без цифр в paging.

Комментарии

Аватар пользователя Nikit Nikit 7 декабря 2009 в 5:59

Файл readme.txt в этом модуле:
3. How can I customize the pager navigation?

Either the theme_pager() function can be overridden to make minor customizations (see http://drupal.org/node/173880#function-override) or a complete new(custom) theme function to use can be specified in paging settings at admin/settings/paging.

Аватар пользователя man-1982 man-1982 7 декабря 2009 в 14:02

Используя themer info нашел функцию theme_item_list($items = array(), $title = NULL, $type = 'ul', $attributes = NULL);
какие параметры нужно ввести в масив $items чтобы получить нужный мне результат. Вернее даже как мне его правильно заполнить. Масив состоит из элементов-массивов[class] и [data].

Аватар пользователя Nikit Nikit 7 декабря 2009 в 14:09

создайте вашатема_item_list($items = array(), $title = NULL, $type = 'ul', $attributes = NULL); в template.php
и уже работайте с ним по желанию.

Аватар пользователя man-1982 man-1982 7 декабря 2009 в 21:31

сделал следующим образом в модуле paging закоментировал часть строк

function theme_paging_drop_down($tags = array(), $limit = 10, $element = 0, $parameters = array(), $quantity = 9, $page_names = array()) {
global $pager_page_array, $pager_total;

$output = '';

// 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.

//$prev_name = truncate_utf8(t($page_names[$pager_current - 2]), 50, TRUE, TRUE);
$li_previous = theme('pager_previous', (isset($tags[1]) ? $tags[1] : t('Previous page !prev', array('!prev' => $prev_name))), $limit, $element, 1);

//$next_name = truncate_utf8(t($page_names[$pager_current]), 50, TRUE, TRUE);
$li_next = theme('pager_next', (isset($tags[3]) ? $tags[3] : t('Next page !next', array('!next' => $next_name))), $limit, $element, 1);

if ($pager_total[$element] > 1) {

$output .= '

';

$output .= '' . $li_previous . '';
$options = '';

/* // Now generate the actual pager piece.
for ($i = 1; $i <= $pager_max; $i++) {
$page = $_GET['page'] ? $_GET['page'] : '0,' . ($i-1);
if (strpos($page, ',') == 1) {
$page = $page[0] . ',' . ($i-1);
}
else if (!empty($_GET['page']) && strpos($page, ',') === FALSE) {
$page = $_GET['page'] . ',' . ($i-1);
}
$url = $i == 1 ? url($_GET['q']) : url($_GET['q'], array('query' => array('page' => $page)));
// Decode the comma entity.
$url = str_replace('%2C', ',', $url);
$options .= theme('paging_drop_down_option', $url, $page_names[$i-1], $i, ($i == ($pager_current)));
}*/

$output .= '

';
//$output .= '' . $options . '';
$output .= '
';
$output .= '' . $li_next . '';
$output .= '

';

drupal_add_js("Drupal.theme.prototype.paging_drop_down = function() {
$('.paging-drop-down select').bind('change', function() {
location.href = $(this).val();
});
};

$(document).ready(function() {
Drupal.theme('paging_drop_down');
});", 'inline');

return $output;
}
}

Но теперь не могу сделать вместо сцылок вперед назад поставить картинки

Аватар пользователя man-1982 man-1982 27 декабря 2009 в 22:34

если кому исчо интересно в template.php добавить функции.
Не забудьте поменять название темы в ункциях "kocheriga"/
Суть пркола в чем - в том чтоу функции l() включаем ввод html=>TRUE;

<?php
function kocheriga_pager_link($text$page_new$element$parameters = array(), $attributes = array()) {
  
$page = isset($_GET['page']) ? $_GET['page'] : '';
  if (
$new_page implode(','pager_load_array($page_new[$element], $elementexplode(','$page)))) {
    
$parameters['page'] = $new_page;
  }

  

$query = array();
  if (
count($parameters)) {
    
$query[] = drupal_query_string_encode($parameters, array());
  }
  
$querystring pager_get_querystring();
  if (
$querystring != '') {
    
$query[] = $querystring;
  }

  

// Set each pager link title
  
if (!isset($attributes['title'])) {
    static 
$titles NULL;
    if (!isset(
$titles)) {
      
$titles = array(
        
t('« first') => t('Go to first page'),
        
t('‹ previous') => t('Go to previous page'),
        
t('next ›') => t('Go to next page'),
        
t('last »') => t('Go to last page'),
      );
    }
    if (isset(
$titles[$text])) {
      
$attributes['title'] = $titles[$text];
    }
    else if (
is_numeric($text)) {
      
$attributes['title'] = t('Go to page number', array('number=> $text));
    }
  }

return 

l($text$_GET['q'], array('attributes' => $attributes'html' => TRUE'query' => count($query) ? implode('&'$query) : NULL));
}

function 

kocheriga_paging_drop_down($tags = array(), $limit 10$element 0$parameters = array(), $quantity 9$page_names = array()) {
  global 
$pager_page_array$pager_total;

  

$output '';

  

// 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.
  
  
  /*
  <img src="/drupal/image" alt="/ga_pager/little_blue/next.png" title="Vorige" />
  */
  
   // $image_next=theme_image('image', '/ga_pager/little_blue/next.png', $alt = 'Vorige', $parameters, true);
    
$image_next=theme('image'path_to_theme() . '/paging/next.png');
    
$image_previous=theme('image'path_to_theme() . '/paging/previous.png');
  
//$prev_name = truncate_utf8(t($page_names[$pager_current - 2]), 50, TRUE, TRUE);
  
$li_previous theme('pager_previous', (isset($tags[1]) ? $tags[1] : $image_previous), $limit$element1);
   
//$next_name = truncate_utf8(t($page_names[$pager_current]), 50, TRUE, TRUE);
  
$li_next theme_pager_next( (isset($tags[3]) ? $tags[3] : $image_next), $limit$element1);

  if (

$pager_total[$element] > 1) {

    

$output .= '<table id="paging-title-navigation" class="paging-drop-down">
    <tbody>
      <tr>
        <td class="previous-page" style="width: 50%; text-align: left;">'
;

    

$output .=  $li_previous  ;
    
$options '';

    

$output .= '</td><td class="paging-drop-down" style="text-align: center;">';
    
    
$output .= '</td>
            <td class="next-page" style="width: 50%; text-align: right;">'
;
    
$output .=  $li_next ;
    
$output .= '</td>
        </tr>
      </tbody>
    </table>'
;

    

drupal_add_js("Drupal.theme.prototype.paging_drop_down = function() {
  $('.paging-drop-down select').bind('change', function() {
    location.href = $(this).val();
  });
};

$(document).ready(function() {
  Drupal.theme('paging_drop_down');
});"

'inline');

    return 

$output;
  }
};

?>