Alpha links default to first numeric page.

sime - October 14, 2007 - 19:54
Project:Views Alpha Pager
Version:5.x-1.4
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

I'm not sure if there is a solution for this. If a visitor is browsing the B's, and is on page 5, all the corresponding alpha pager links are also set to page 5. My site owner wants the visitor to start at page 1 of each letter.

The following hack seems to work for me. Obviously not happy doing a hack, so if there are any better solutions I'm happy to hear.

<?php
function theme_alpha_pager_link($item, $item_display, $attributes = array(), $path = '', $query = '') {

/*
  if ($query != '') {
    $query .= '&';
  }
  $query .= 'apage='. $item;
*/
  // Force all alpha pager links to have no "page=x"
  // For some reason this does not break the actual numeric pager links.
 
$query = 'apage='. $item;

 
$attributes['title'] = t('Go to @page listings', array('@page' => $item));
  return
l($item_display, $path, $attributes, $query);
}
?>

#1

colliny2k - April 14, 2008 - 19:55
Version:5.x-1.1» 5.x-1.4

I find this to be a problem as well. The page should always default to 1 when choosing a new letter.

By the way, I think this should really be a bug report...not so much support request.

I've updated the above hack for views_alpha_pager 1.4......although I too hate hacks.

<?php
function theme_alpha_pager_link($item, $item_display, $attributes = array(), $link = array()) {
/*
  if ($link['query'] != '') {
    $link['query'] .= '&';
  }
  $link['query'] .= 'apage='. $item;
*/
  // Force all alpha pager links to have no "page=x"
 
$link['query'] = 'apage='. $item;

 
$attributes['title'] = t('Go to @page listings', array('@page' => $item_display));
  return
l($item_display, $link['href'], $attributes, $link['query']);
}
?>

#2

alanburke - July 2, 2008 - 08:19
Category:support request» bug report

I guess it might just be a personal opinion,
but I feel that this is a bug too.

[This is the kind of stuff that good uasbility testing could decide, rather than "I think" this is how it should function]

Alan

#3

douggreen - July 2, 2008 - 10:41
Status:active» fixed

Thanks! The fix was something relatively minor, adding 'page' to array in drupal_query_string_encode(). I've checked this in, and it's now available in the dev release.

#4

Anonymous (not verified) - July 23, 2008 - 10:56
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.