There are two things you need when building your query.
1. The 'PagerDefault' extend
2. The pager theme in your returned array.
<?php
function example_pager(){
$select = db_select('node','n')
->fields('n', array('nid')
->condition('status', 1)
->orderBy('created', 'DESC')
->extend('PagerDefault')
->limit(10);
$nids = $select->execute();
if(!empty($nids)){
$nodes = node_load_multiple($nids);
$build = node_view_multiple($nodes);
$build['pager'] = array(
'#theme' => 'pager',
'#weight' => 5
);
}
return
$build;
}
?>If you need high quality design services for brochure websites or content management systems, you are in the right place.
Custom Drupal Modules
PHP Programming
Website Debugging
Facebook Apps
Business Intranet sites.
1-on-1 Drupal tutorials.