1
votes

I was using a EntityFieldQuery to collect my data and print it on my page. After that, I decided to add a pager to it all. Somehow, I do not understand the pager didn't work. I then tried integrating this on my localhost on an old drupal 7.22 installation I had. Since I had the same field names I was okay. To my astonishment I saw that my code was working perfectly. I tried installing a recent drupal version to see how it would go along. Nothing worked.

Now to my actual question. What could be different on my older drupal installation that could let the pager work and not make it work on a recent 7.24 clean install?

Also I tried implementing this code to test out the pager:


    $header = array(
      array('data' => 'Title',     'field' => 'title'),
      array('data' => 'Date created', 'field' => 'created'),
      array('data' => 'Type',           'field' => 'type'),
    );

    $nodes = db_select('node', 'n')
      ->fields('n', array('title', 'created', 'type'))
      ->extend('PagerDefault')
      ->limit(10)
      ->extend('TableSort')
      ->orderByHeader($header)
      ->execute();

    $rows = array();
    foreach ($nodes as $node) {
      $rows[] = array(
        check_plain($node->title),
        format_date($node->created),
        $node->type
      );
    }

    $output = theme('table', array('header' => $header, 'rows' => $rows));
    $output .= theme('pager');

    print render($output);

Everything was working on my older installation and not on the recent ones..

Help would be really appreciated.. Thanks

1
This is NOT an EntityFieldQuery. Here is how to use this class: drupal.org/node/1343708 - Matthieu Bilbille
What do you mean by "Nothing worked"? You get an error/exception? A blank result? etc.? As well, did you use the exact same database data? - Matthieu Bilbille
Yeah sorry this isn't an EFQ. Anyway I finally made the pager work by setting up a homepage in drupal's settings. - Alex

1 Answers

0
votes

Anyway I finally made the pager work by setting up a homepage in drupal's settings.