Skip to content
This repository has been archived by the owner on Jul 7, 2022. It is now read-only.

Function : pagination_helper()

Blair2004 edited this page Nov 20, 2014 · 7 revisions

Description : Create a custom pagination data (Array) for specific datas given. As you provide, how many items to display per page, how many items exists, what is the current page, and so on, this function will return an Array, which can be used with bootstrap_pagination_parser() for generating HTML code, since you use the index "1" from this returned Array.

This function takes 4 parameters :

  • How many items per page (Int)
  • How many items exists (Int)
  • What is the current page (Int)
  • What is the base url. You can use "get_instance()->url" object for generating URLs (String)
  • Redirection Array (Array) [optional], in case an attempt who lead to a 404 page, you can set a custom redirection route (Specialy when creating modules). If not sets, it lead to default error page 404.

Example :

<?php $pagination_datas = pagination_helper( 
     10 , 
     3000 , 
     2, 
     get_instance()->url->site_url( array( 'admin' , 'open' , 'modules' , 'custom-module' , 'index' ) ) , 
     array( 'admin' , 'open' , 'modules' , 'custom-module' , 'page404' ) 
);?>