Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5953709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:51:53+00:00 2026-05-22T17:51:53+00:00

I went onto the Drupal website and found the theme hook for theme_pager I

  • 0

I went onto the Drupal website and found the theme hook for theme_pager I have copied the code from the comments to do a devient art style pager as this is close to what I need although when I am implmenting it i am getting

“1 Array Array Array Array”

This is the code from http://api.drupal.org/api/drupal/includes–pager.inc/function/theme_pager/6:

 function yourthemename_pager($tags = array(), $limit = 10, $element = 0, $parameters = array(), $quantity = 5) {
  global $pager_page_array, $pager_total;
  $tags = array("", "< prev", "", "next >", "");

 // Calculate various markers within this pager piece:
 // Middle is used to "center" pages around the current page.
 $pager_middle = ceil($quantity / 2);
 // current is the page we are currently paged to
 $pager_current = $pager_page_array[$element] + 1;
 // first is the first page listed by this pager piece (re quantity)
 $pager_first = $pager_current - $pager_middle + 1;
 // last is the last page listed by this pager piece (re quantity)
 $pager_last = $pager_current + $quantity - $pager_middle;
 // max is the maximum page number
 $pager_max = $pager_total[$element];
 // End of marker calculations.

 // Prepare for generation loop.
 $i = $pager_first;

 if ($pager_last > $pager_max) {
 // Adjust "center" if at end of query.
 $i = $i + ($pager_max - $pager_last);
 $pager_last = $pager_max;
 }

 if ($i <= 0) {
 // Adjust "center" if at start of query.
 $pager_last = $pager_last + (1 - $i);
 $i = 1;
 }
 // End of generation loop preparation.

 $li_previous = theme('pager_previous', (isset($tags[1]) ? $tags[1] : t('‹ previous')), $limit, $element, 1, $parameters);
 $li_next = theme('pager_next', (isset($tags[3]) ? $tags[3] : t('next ›')), $limit, $element, 1, $parameters);

 if ($pager_total[$element] > 1) {

      if ($li_previous) {
       $items[] = array(
        'class' => 'pager-previous',
        'data' => $li_previous,
       );
      }

// When there is more than one page, create the pager list.
if ($i != $pager_max) {
  // Now generate the actual pager piece.
  for (; $i <= $pager_last && $i <= $pager_max; $i++) {
    if ($i < $pager_current) {
  if ($pager_first > 1 && $i == $pager_first) {
   $output = '...'.$i;
   $stopPreEllipsis = true;
  } else {
   $output = $i;
  }
      $items[] = array(
        'class' => 'pager-item',
        'data' => theme('pager_previous', $output, $limit, $element, ($pager_current - $i), $parameters),
      );
    }
    if ($i == $pager_current) {
      $items[] = array(
        'class' => 'pager-current',
        'data' => $i,
      );
    }
    if ($i > $pager_current) {

  if ($pager_last < $pager_max && $i == $pager_last) {
   $output = $i.'...';
  } else {
   $output = $i;
  }

      $items[] = array(
        'class' => 'pager-item',
        'data' => theme('pager_next', $output, $limit, $element, ($i - $pager_current), $parameters),
      );
    }
  }
}
// End generation.
if ($li_next) {
  $items[] = array(
    'class' => 'pager-next',
    'data' => $li_next,
  );
}

return theme('item_list', $items, NULL, 'ul', array('class' => 'pager'));
  }
}

Please help.

Idealy I would like a pager like this:

< 1 2 3 4 5 6 7 8 9 10 > (all the page numbers with next and previous) – But if I can get around this issue of Array then I should be able to modify the code.

Thanks
James

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T17:51:54+00:00Added an answer on May 22, 2026 at 5:51 pm

    Install devel module, replace all the print statements in the code with, dpms. That way you will get to know what are contents of the array and then you can print whatever is required.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use carp free 3.6.4 to display content from some wordpress rss feeds onto
I've been working on a on uploading my RoR3 website onto Heroku. Took me
I have created a google project... went new web project with the gwt/gae plugin.
This code was working fine until i went to firefox 4 and now it
I have migrated a website to cloud, which works perfectly on my local machine
I went to all the documentation, also I went to the IRC channel (BTW
I went to school for programming years ago and when I got out I
I went to http://www.json.org/js.html and downloaded the json2.js, thinking i'd be fine, afterall that
I went through a period of being interested in how quantum computers work and
I just went through some MVC tutorials after checking this site out for a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.