I've decided to document here as an issue, as the solution relies on a pending patch #106803: View arguments via PHP snippet. I hope this saves others some headache :)

Use case example:
I have a photo that can be referenced from several albums.
When passing the URL like this node/[photo-nid]/[album-nid] (e.g. node/1/view/2) the page appears without it's comments (this seems to be solved in D6).

It's better to pass it like this node/1?pager_view=2, so the page will appear correctly.

Solution:
1. Apply the patch
2. In the Arguments I entered this code (without the PHP tags) and set the Arguments format to PHP (snap1.png)

return explode('/', $_GET['view_pager']);

3. I've overridden theme_custom_pager():

/**
 * Implementation of theme_custom_pager().
 * 
 * Pass URL arguments that are used when paging content referred from a style. 
 */
function zen_custom_pager($nav_array, $node, $pager) {
  drupal_add_css(drupal_get_path('module', 'custom_pagers') .'/custom_pagers.css');
  $links = array();
  $suffix =  'view_pager='. $_GET['view_pager'];
  $links['custom_pager_prev'] = array(
    'title' => t('ג€¹ previous'),
    'href' => !empty($nav_array['prev']) ? 'node/'. $nav_array['prev'] : NULL,
    // We are adding our arguments as a query (i.e. after the ? symbol).
    'query' => !empty($nav_array['prev']) ? $suffix : NULL,
  );
  $links['custom_pager_index'] = array(
    'title' => ($nav_array['current_index'] + 1) .' of '. count($nav_array['full_list']),
  );
  $links['custom_pager_next'] = array(
    'title' => t('next ג€÷'),
    'href' => !empty($nav_array['next']) ? 'node/'. $nav_array['next'] : NULL,
    'query' => !empty($nav_array['prev']) ? $suffix : NULL,  
  );
    
  return theme('links', $links, array('class' => "custom-pager custom-pager-$pager->pid custom-pager-$node->type"));
}

(see the $suffix part that was changed).

CommentFileSizeAuthor
#1 Snap1.png10.99 KBamitaibu

Comments

amitaibu’s picture

StatusFileSize
new10.99 KB

snap1.png