From 4b9c62980599228f070b401c7673dce8085b0c61 Mon Sep 17 00:00:00 2001
From: Derek Jones 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 $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. 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 pagination.php, add the $config
+Simply create a new file called 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.
$config['base_url'] = 'http://example.com/index.php/test/page/';
$config['total_rows'] = 200;
-$config['per_page'] = 20;
+$config['per_page'] = 20;
$this->pagination->initialize($config);
-echo $this->pagination->create_links();
+echo $this->pagination->create_links();
Notes:
-
-
Setting preferences in a config file
By default, the pagination library assume you are using URI Segments, and constructs your links something like
http://example.com/index.php/test/page/20
If you have $config['enable_query_strings'] set to TRUE your links will automatically be re-written using Query Strings. This option can also be explictly set. Using $config['page_query_string'] set to TRUE, the pagination link will become.
+If you have $config['enable_query_strings'] set to TRUE your links will automatically be re-written using Query Strings. This option can also be explictly set. Using $config['page_query_string'] set to TRUE, the pagination link will become.
http://example.com/index.php?c=test&m=page&per_page=20
Note that "per_page" is the default query string passed, however can be configured using $config['query_string_segment'] = 'your_string'
+Note that "per_page" is the default query string passed, however can be configured using $config['query_string_segment'] = 'your_string'
If you would like to surround the entire pagination with some markup you can do it with these two prefs:
-- cgit v1.2.3-24-g4f1b