• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pagination Problem

#1
[eluser]Lazos[/eluser]
I have this code inside my controller.
In my CONFIG file I have $config['enable_query_strings'] = TRUE;
Even I write $config['page_query_string'] = TRUE or FALSE still at the end of the link I am getting /index.php/admin/adminlog/&per_page=20 which is wrong I thing.

How to fix it to get links like this /index.php/admin/adminlog/page/20
I can not change the one of the config file because most of my inks pass parameters like this adminlog?param=1

Code:
$config['per_page'] = '20';
        $this->adminlog = $this->adminlog_lib->getAllLogs($config['per_page'], $this->uri->segment(3));
        $count = $this->adminlog_lib->countLogs();
        $this->load->library('pagination');
        $config['base_url'] = base_url().'/index.php/admin/adminlog/';
        $config['total_rows'] = $count;
        $this->pagination->initialize($config);

#2
[eluser]fesweb[/eluser]
Do you have query strings enabled in your CI config (config/config.php)?

If so, then it doesn't matter what you set in the pagination config, it will give you a query string.

The solution I went with was to copy the pagination library into my application's libraries (libraries/Pagination.php) and edit the two places which check for query strings.

Code:
// change this
$CI->config->item('enable_query_strings') === TRUE OR $this->page_query_string === TRUE
// to this
$CI->config->item('enable_query_strings') === TRUE AND $this->page_query_string === TRUE

#3
[eluser]domcat[/eluser]
[quote author="fesweb" date="1228169042"]Do you have query strings enabled in your CI config (config/config.php)?

If so, then it doesn't matter what you set in the pagination config, it will give you a query string.

The solution I went with was to copy the pagination library into my application's libraries (libraries/Pagination.php) and edit the two places which check for query strings.

Code:
// change this
$CI->config->item('enable_query_strings') === TRUE OR $this->page_query_string === TRUE
// to this
$CI->config->item('enable_query_strings') === TRUE AND $this->page_query_string === TRUE
[/quote]Didn't work for me unfortunately. I'm really frustrated by the query strings limitation...

#4
[eluser]domcat[/eluser]
Actually, this did work for me. Forgot to set page_query_string to FALSE.

#5
[eluser]JoostV[/eluser]
You might like the automated pagination lib I wrote for CI> You can find it here:
http://ellislab.com/forums/viewthread/86428/

Basically, once you load the library you have instant pagination. It just assumes that you use the following naming convention for paging: Page/offset. You need to have this somewhere (anywhere) in your URI.

You dont need QUERY_STRING to use this lib.

#6
[eluser]learnq[/eluser]
I have the same problem . I fix it as said befor

Code:
$CI->config->item('enable_query_strings') === TRUE AND $this->page_query_string === TRUE
and
$config['page_query_string']=FALSE;

but it cannot determine the current page number. ie, if I click page 2 it shows the content of page 2 but the link shows that it is page 1 .

in my config.php

Code:
$config['uri_protocol']    = "AUTO";    
$config['enable_query_strings'] = TRUE;

I need to use both url sigment and query string.

Any help appreciated.

#7
[eluser]learnq[/eluser]
solved ,
Code:
$config['uri_segment']
need to be set accourding to requirement.As default is 3 .


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.