I have a code, that outputs a standard pager:
print theme('pager');
it outputs this:
<h2 class="element-invisible">Pages</h2>
<div class="item-list">
<ul class="pager"><li class="pager-current first">1</li>
<li class="pager-item"><a title="Go to page 2" href="/drupal/node?page=1">2</a></li>
<li class="pager-item"><a title="Go to page 3" href="/drupal/node?page=2">3</a></li>
<li class="pager-next"><a title="Go to next page" href="/drupal/node?page=1">next ›</a></li>
<li class="pager-last last"><a title="Go to last page" href="/drupal/node?page=5">last »</a></li>
</ul>
How can I change the HTML to something like this:
<ul class="pagination">
<li><a href="#"><</a></li>
<li><a href="#">1</a></li>
<li><a href="#" class="active">2</a></li>
<li><a href="#">3</a></li>
<li><a href="#">></a></li>
</ul>
I looked into this thread: https://www.drupal.org/node/387786, created a function bartik_preprocess_custom_pager
and a file custom-pager.tpl.php
inside my Bartic theme templates, but I can't make it work.
print theme('custom_pager');
outputs nothing. Does anybody know, how can I customize the HTML output for a pager, creating one just for 1 page?
hook_theme()
, or Drupal will not know there is a new theme function. Clear the cache after changing a theme.theme('pager');
. Now I don't get them.$variables
automatically; you just need to implementhook_theme()
correctly. For changing a theme function from a module, the hook to implement ishook_theme_registry_alter()
.