PHP Classes

File: readme

Recommend this page to a friend!
  Classes of Eugene Olkhovick   eoPaginator   readme   Download  
File: readme
Role: Documentation
Content type: text/plain
Description: Readme file about eoPaginator class
Class: eoPaginator
Generate navigation for listings split among pages
Author: By
Last change:
Date: 14 years ago
Size: 3,219 bytes


Class file image Download
@ Class: eoPaginator @ Description: Class provides pagination bar output in three diffrent manners. This is a small and simple class that can be used to compose navigation links bar for paginated displaying of some data arrays.The class provides three different modes of page links output: shifting mode, sliding mode and intersection mode, which require session mechanism is to be used. array make_pgr(int rec_total,int cur_page>) - function get two parameters: rec_total - total amount of records in a table or array; cur_page - curren page number; Function returns an array of <a> elements. All other variable described in class file. Little example file "example.php" shows how you can use eoPaginator class. It is necessary to describe conceptions of provided modes: Shift mode ========== For example you get first interval of available pages, limited by <max_pages> parameter. In our case max_pages=5 (for example), so we have element range from 1 to 5: |1|2|3|4|5| > >> When you click on last element in this range, |5| in our case, the next range of links will appear: << < |6|7|8|9|10| > >> So we have next 5 (max_pages, remember ???) elements, now from 6 to 10. And so on.... Slide mode ========== That's trivial... Current page link will always been showed in the middle of the range, begining from central element of the first page range. So, when you click on the next page link after the central, all range will be shifted right or left accordingly. |1|2|3|4|5| > >> --- ^ - central element of this range. - << < |2|3|4|5|6| > >> - that's what you will see if you click on |4| element of previous range. Current page is - 4. Now click to |5| - - << < |3|4|5|6|7| > >> - Current page is - 5. - So, as you can see, current page is always in the middle position. Intersection mode ================= Every following page diapason intersect with previous one with predefined overlap. For example, traditionally first range, <overlap> parameter = 2: |1|2|3|4|5| > >> - click on last range element |5| will couse appearence of the next range << < |4|5|6|7|8| > >> --- | - first two elements of new range is in one's turn last two (2 - is our overlap value) elements of previous one Now let's click |8|. << < |7|8|9|10|11| > >> --- | - first two elements equals to last elements of previous range. Obviously, in a case when the same element can be in two ranges at one time, it is necessary to know wich one to show when this element will be clicked. Session variable is used for storing number of current page range. If selected page number is in the lowest range, highest range will be shown and vice-versa. The class is not perferct, so I'm ready to comments, critic and suggestion about how to make it better.