Hi,
I'm still reasonably new to Drupal.
I'm not sure if this issue actually belongs under theme system or base system, but I'm trying to theme my pager links to be images instead of text.
I've trawled through various searches but have come up empty.
I did manage to find a function for my template.php page which allows me to make changes to the pager output - such as making the link text different or adding classes, etc. However I can't make them into image links.
Looking at the api documentation for theme_pager_previous (for example) under Parameters it says...
$text The name (or image) of the link.
But I can't work out how to present the image.
This is what I have added to my template.php file
(I've removed the 'first' and 'last' links too)
function phptemplate_pager($tags = array(), $limit = 10, $element = 0, $parameters = array()) {
global $pager_total;
$output = '';
if ($pager_total[$element] > 1) {
$output .= '<div class="pager">';
/* My 'previous' link */
$output .= theme('pager_previous', ($tags[1] ? $tags[1] : theme_image('path/to/images/pager-prev.jpg', 'Prev', 'Click to see the previous set of results', array('border' => 0), TRUE)), $limit, $element, 1, $parameters);
/* Links to specific pages in the result set */
$output .= theme('pager_list', $limit, $element, ($tags[2] ? $tags[2] : 9 ), '', $parameters);
/* My 'next' link */
$output .= theme('pager_next', ($tags[3] ? $tags[3] : theme_image('path/to/images/pager-next.jpg', 'Next', 'Click to see the next set of results', array('border' => 0), TRUE)), $limit, $element, 1, $parameters);
$output .= '</div>';
return $output;
}
}
As you can see I've tried using the theme_image function. It actually outputs the correct img source but as simply as plain text in the link, not an image file.
I've also tried not using theme_image and simply putting the image url (based on the theme_pager_previous note above) but that simply placed the image url as the text for the link.
Can someone please help me out here? Have I got it all wrong?
Comments
Comment #1
beekay1076 commentedHi all
Well I must have searched on the wrong terms.
I have found a solution using the code supplied by wmostery at http://drupal.org/node/35464 and replacing the text with an image using the theme_image function
Works a treat.
Below is the code I'm using.
Comment #2
beekay1076 commentedClosing now.
Comment #3
Roelven commentedSee also http://drupal.org/node/318565
Comment #4
jmlavarenne commentedI'm not able to get this to work :(
This escapes the html in a way that I see it printed on the page as such :
and in the source code as such :
Comment #5
jmlavarenne commentedComment #6
jmlavarenne commentedThere is an l() in theme_pager_links() that prevent images from appearing in the pager.
I overwrote it as explained here :
http://drupal.org/node/318565#comment-1079877
Comment #7
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.