There are a few concepts that I need to better understand to better grasp, for this function, paging though these concepts will help for all my future Drupaling. :)
I am trying use the ->entend(DefaultPager); function and am not QUITE understanding how to use it.
Here is my code:
$query = db_select($products_table, 'a');
$query->join('acpac_xml_products', 'b', 'b.itemno = a.itemno'); //JOIN node with users
$query->fields('a',array('itemno','baseprice','salesprice','pricelist'))//SELECT the fields from node
->fields('b',array('sales','prodtype','category','qtyonhand'))//SELECT the fields from user
->extend('PagerDefault')
->range(0,100);//LIMIT to 100 records
foreach($products as $product){
$rows[] = array($product->itemno,$res->dec,$res->date);
}
$output = theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'my-module-table')));
$output .= theme('pager');
$output .= pager_find_page($element = 0);
$output .= theme_pager($tags = array(), $limit = 10, $element = 0, $parameters = array(), $quantity = 9);
$output .= theme_pager_first('first');
$output .= theme_pager_last('last');
print $output;
Notes:
- The output works in so much as 100 rows with data are displaying.
- Notice the 4 appended $output .= vars were added by me. The rest of the code is an example from Drupal.