Skip to content

Instantly share code, notes, and snippets.

@bfodeke
Created February 7, 2017 18:51
Show Gist options
  • Save bfodeke/cfa73a1d361722a50a66f19e3f1bc7fb to your computer and use it in GitHub Desktop.
Save bfodeke/cfa73a1d361722a50a66f19e3f1bc7fb to your computer and use it in GitHub Desktop.
/**
* https://www.drupal.org/node/1966736#comment-8792051
*/
<?php
$per_page = 10;
// Initialize the pager
$current_page = pager_default_initialize(count($rows), $per_page);
// Split your list into page sized chunks.
$chunks = array_chunk($rows, $per_page, TRUE);
// Show the appropriate items from the list
$output = theme('table', array('header' => $header, 'rows' => $chunks[$current_page]));
// Show the pager
$output .= theme('pager', array('quantity',count($rows)));
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment