Greetings,
I've managed to get the custom pagers module up and running and wanted to share a way to display icons in the navigation instead of textlinks. Here is how it is done:
1. Put this code into the "custom-pager.tpl.php" file, replacing the old code:
?>
<ul class="custom-pager custom-pager-<?php print $position; ?>">
<li class="first"><?php print $first; ?></li>
<li class="previous"><?php print $previous; ?></li>
<li class="next"><?php print $next; ?></li>
<li class="last"><?php print $last; ?></li>
</ul>
2. in the "custom_pagers.module" file, scroll down to the very end of the file and replace this part of code...:
$vars['previous'] = !empty($nav['prev']) ? l(t('‹ previous'), 'node/'. $nav['prev']) : '';
$vars['key'] = t('@count of @count_total', array('@count' => ($nav['current_index'] + 1), '@count_total' => count($nav['full_list'])));
$vars['next'] = !empty($nav['next']) ? l(t('next ›'), 'node/'. $nav['next']) : '';
...by this one:
$vars['previous'] = !empty($nav['prev']) ? l("<img src='insert url to the desired icon here'/>",'node/'. $nav['prev'], array("html"=>true)) : '';
$vars['key'] = t('@count of @count_total', array('@count' => ($nav['current_index'] + 1), '@count_total' => count($nav['full_list'])));
$vars['next'] = !empty($nav['next']) ? l("<img src='insert url to the desired icon here'/>",'node/'. $nav['next'], array("html"=>true)) : '';
$vars['first'] = !empty($nav['first']) ? l("<img src='insert url to the desired icon here'/>",'node/'. $nav['first'], array("html"=>true)) : '';
$vars['last'] = !empty($nav['last']) ? l("<img src='insert url to the desired icon here'/>",'node/'. $nav['last'], array("html"=>true)) : '';
replace "insert url to the desired icons here" with the actual url to your icon image.
3. replace all the code in your "custom_pagers.css" file with this one:
ul.custom-pager {
margin: 0;
padding: 0;
text-align: center;
}
ul.custom-pager li {
margin: auto;
padding: 0;
display: inline;
width: 32%;
list-style-type: none;
list-style-image: none;
background: none;
white-space: nowrap;
}
Et voila you're done. Just remember to grab a few navigations icons form the web. I took the ones from here: http://www.iconspedia.com/pack/buttons-554/
The end-result will look something like this (see attachment):
| Comment | File | Size | Author |
|---|---|---|---|
| pagers.jpg | 75.59 KB | paddes |
Comments
Comment #1
huayen commentedcool! Thanks.
Comment #2
Andrey Zakharov commentedgoddie dr6 preprocess not work :(
Comment #3
jdln commentedWorked for me but I copied the entire function from the module into my template.php file. So this should still work if the module is updated.
Thanks Paddes
Comment #4
jdln commentedI should specify, the code i pasted is from the module, so you need to change it to what you want it to be as Paddes described.