From b0dd10f8171945e0c1f3527dd1e9d18b043e01a7 Mon Sep 17 00:00:00 2001 From: admin Date: Fri, 25 Aug 2006 17:25:49 +0000 Subject: Initial Import --- user_guide/libraries/pagination.html | 218 +++++++++++++++++++++++++++++++++++ 1 file changed, 218 insertions(+) create mode 100644 user_guide/libraries/pagination.html (limited to 'user_guide/libraries/pagination.html') diff --git a/user_guide/libraries/pagination.html b/user_guide/libraries/pagination.html new file mode 100644 index 000000000..3f4e56935 --- /dev/null +++ b/user_guide/libraries/pagination.html @@ -0,0 +1,218 @@ + + + + +Code Igniter User Guide + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +

Code Igniter User Guide Version 1.4.0

+
+ + + + + + + + + +
+ + +
+ + + +
+ + +

Pagination Class

+ +

Code Igniter's Pagination class is very easy to use, and it is 100% customizable, ether dynamically or via stored preferences.

+ +

If you are not familiar with the term "pagination", it refers to links that allows you to navigate from page to page, like this:

+ +« First  < 1 2 3 4 5 >  Last » + +

Example

+ +

Here is a simple example showing how to create pagination in one of your controller functions:

+ + +$this->load->library('pagination');

+$config['base_url'] = 'http://www.your-site.com/index.php/test/page/';
+$config['total_rows'] = '200';
+$config['per_page'] = '20'; +

+$this->pagination->initialize($config); + +

+echo $this->pagination->create_links();
+ +

Notes:

+ +

The $config array contains your configuration variables. It is passed to the $this->pagination->initialize function as shown above. Although there are some twenty items you can configure, at +minimum you need the three shown. Here is a description of what those items represent:

+ + + +

The create_links() function returns an empty string when there is no pagination to show. + + +

Setting preferences in a config file

+ +

If you prefer not to set preferences using the above method, you can instead put them into a config file. +Simply create a new file called the pagination.php, add the $config +array in that file. Then save the file in: config/pagination.php and it will be used automatically. You +will NOT need to use the $this->pagination->initialize function if you save your preferences in a config file.

+ + +

Customizing the Pagination

+ +

The following is a list of all the preferences you can pass to the initialization function to tailor the display.

+ + +

$config['uri_segment'] = 3;

+ +

The pagination function automatically determines which segment of your URI contains the page number. If you need +something different you can specify it.

+ +

$config['num_links'] = 2;

+ +

The number of "digit" links you would like before and after the the selected page number. For example, the number 2 +will place two digits on either side, as in the example links at the very top of this page.

+ +

Adding Enclosing Markup

+ +

If you would like to surround the entire pagination with some markup you can do it with these two prefs:

+ +

$config['full_tag_open'] = '<p>';

+

The opening tag placed on the left side of the entire result.

+ +

$config['full_tag_close'] = '</p>';

+

The closing tag placed on the right side of the entire result.

+ + +

Customizing the First Link

+ +

$config['first_link'] = 'First';

+

The text you would like shown in the "first" link on the left.

+ +

$config['first_tag_open'] = '<div>';

+

The opening tag for the "first" link.

+ +

$config['first_tag_close'] = '</div>';

+

The closing tag for the "first" link.

+ +

Customizing the Last Link

+ +

$config['last_link'] = 'Last';

+

The text you would like shown in the "last" link on the right.

+ +

$config['last_tag_open'] = '<div>';

+

The opening tag for the "last" link.

+ +

$config['last_tag_close'] = '</div>';

+

The closing tag for the "last" link.

+ +

Customizing the "Next" Link

+ +

$config['next_link'] = '&gt';

+

The text you would like shown in the "next" page link.

+ +

$config['next_tag_open'] = '<div>';

+

The opening tag for the "next" link.

+ +

$config['next_tag_close'] = '</div>';

+

The closing tag for the "next" link.

+ +

Customizing the "Previous" Link

+ +

$config['prev_link'] = '&lt';

+

The text you would like shown in the "previous" page link.

+ +

$config['prev_tag_open'] = '<div>';

+

The opening tag for the "previous" link.

+ +

$config['prev_tag_close'] = '</div>';

+

The closing tag for the "previous" link.

+ +

Customizing the "Current Page" Link

+ +

$config['cur_tag_open'] = '<b>';

+

The opening tag for the "current" link.

+ +

$config['cur_tag_close'] = '</b>';

+

The closing tag for the "current" link.

+ + +

Customizing the "Digit" Link

+ +

$config['num_tag_open'] = '<div>';

+

The opening tag for the "digit" link.

+ +

$config['num_tag_close'] = '</div>';

+

The closing tag for the "digit" link.

+ + + +
+ + + + + + + \ No newline at end of file -- cgit v1.2.3-24-g4f1b