Flipkart

Friday, June 10, 2011

Implement Start Number and End Number of the Search Results in Drupal

Here is the code for implement start result and end result of the search results in Drupal.
 First we need to define Global variables of the Pager.


global $pager_page_array, $pager_total, $pager_total_items;

//establish page variables
  $total_pages = $pager_total['0'];
  $total_page_count = $total_pages - 1;
  //approx number of results based on page count
  $approx_results = $total_pages * 10;
  //calculate range
  $page_number = $pager_page_array['0'];
  $start_result = $page_number * 10 + 1;
  $end_result = $page_number * 10 + 10;

No comments:

Post a Comment