• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cannot get pagination to work.

#1
[eluser]alphabase[/eluser]
Hi,

I've some problem with the functioning of my pagination.
When I click the URL's generated by pagination, they look like this:
Quote:http://example.com/topfive/show_all_top_five&per_page=4

And when I click one of the URL's, I get:
Quote:404 Page Not Found

My CI-config has been tweaked a little in order to get the Facebook SDK working, here's some information:
Code:
$config['base_url'] = '';
$config['index_page'] = '';
$config['uri_protocol'] = 'QUERY_STRING';
$config['allow_get_array'] = TRUE;
$config['enable_query_strings'] = TRUE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';

$route['default_controller'] = "topfive";
$route['404_override'] = '';

Here's some extraction of my .htaccess, which also contains short SEO-friendly URLs:
Code:
<IfModule mod_rewrite.c>

RewriteEngine on
RewriteBase /

# Prevent access to the system directory
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

# Prevent access to the application directory
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

# Footer custom URL's
RewriteRule ^about/?$ topfive/page/about [NC,L]
RewriteRule ^contact/?$ topfive/page/contact [NC,L]

# Remove the index.php from the URL
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]

</IfModule>

And I would like to use this code to get pagination working, but that's the problem at this point:
Code:
function show_all_top_five($offset=0) {
$data['title'] = 'All TopFives';
$data['tab'] = 2;
$config['base_url'] = BASE.'topfive/show_all_top_five';
$config['total_rows'] = $this->mtopfive->showAllTopFive($offset,0);
$config['per_page'] = '2';
$config['page_query_string'] = FALSE;
$config['uri_segment'] = 3;

$data['total_page']    = ceil($config['total_rows'] / $config['per_page']);
$data['current_page']  = (ceil($offset/2)+1);        

$config['num_links']    = 10;        
$config['prev_link']   = '< Previous';
$config['next_link']   = '- Next >';
$config['num_tag_open'] = ' - ';
if($data['current_page']>1)
    $config['cur_tag_open'] = ' - ';

$this->load->library('pagination');
$this->pagination->initialize($config);
$data['link'] = $this->pagination->create_links();
$data['top_five']= $this->mtopfive->showAllTopFive($offset,2);
$this->session->set_userdata('redirect','topfive/show_all_top_five/'.$offset);    
$this->load->view('vheader',$data);
$this->load->view('vshowtopfive', $data);
$this->load->view('vfooter');
}

I hope someone has got a working solution for me.
It's getting too blurry now, because I've been trying to tweak CI to get my Facebook-SDK working, but now other normal stuff doesn't seem to work anymore.
I need the allow_get_array, since Facebook returns to my site after login with some $_GET parameters.

Any help is appreciated, thanks for your time.

With kind regards,
Gerard Nijboer

#2
[eluser]alphabase[/eluser]
*bump*

#3
[eluser]Aken[/eluser]
Query strings start with a question mark.
Code:
http://example.com/topfive/show_all_top_five?per_page=4

#4
[eluser]alphabase[/eluser]
Hi Aken,

Thanks for your reply.
I understand what you mean, and that it should get me to thinking about the issue again, but I'm having a hard time with combining the query strings with the other SEO-friendly URLs.

Could you give me a more concrete hint on how to fix this?

Gerard


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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