a function to simplify and centralise pagination links

Created by: xing, Last modification: 16 Jan 2007 (15:02 UTC) by hiran
function.pagination.php allows you to simply include standardised, centralised and wellformed pagination links.

  • requirements
    • none
  • suggested variables to be used
    • find (if search feature is used)
      • used to limit list of items to searchcriteria
    • sort_mode
      • used to define what column in the table is used to sort the data
    • prev_offset
      • used to establish what item the previous page begins with
    • next_offset
      • used to establish what item the next page begins with
    • selector_offset
      • used to establish what item any page begins with
  • limits
    • none(?)


php file
pass all pagination related variables to the smarty template

tpl file

{pagination find=$find sort_mode=$sort_mode}

if you wish to pass many parameters to the pagination function, you can keep things clean by passing an array with all variables called 'pgn_params'
php file

= array (
find => $find,
sort_mode => $sort_mode,
name1 => $val1,
name2 => $val2

template file

{pagination pgn_params=$pgn_params}

other notes

the offset variables do not have to be passed to the pagination function if their names are used as explained above
the template used to display pagination links, can be found in
to bundle parameters in an array you must use pgn_params

See also