Welcome Guest, Not a member yet? Register   Sign In
My Pagination Trouble
#1

[eluser]daweb[/eluser]
Hi everybody,

I'm on a pagination issue about four days...

I ask your help.

Try to explain myself in English...

In my Routes.php I have

Code:
$route['(one/(:any)|one)'] = 'home';
$route['(two/(:any)|two)'] = 'home';

So I have some dynamical pages like this:
/my-site/one
/my-site/two/italy
/my-site/one/italy/rome
/my-site/one/italy/rome/hotels
/my-site/two/italy/venice/hotels/san-marco-place

and so on...

I need to use the pagination class in all my pages and it returns the right links in all ones.

so, I can have /my-site/one/2
/my-site/one/italy/rome/hotels/6
/my-site/two/italy/venice/hotels/san-marco-place/2


The pagination works fine, but it doesn't return the correct current page.
It remains stopped to the first link (1)

May you help me in any way?
#2

[eluser]ontguy[/eluser]
It may have to do with configuration variable for the uri_segment; $config['uri_segment'] = 3, for you it may change depending on the url.

Please paste your pagination setup.
#3

[eluser]Michael Wales[/eluser]
Routes are very specific - for instance:
Code:
$route['(one/(:any)|one)'] = 'home';
Is only going to match against 'one/[anything here]' - it will not match against 'one/[anything here]/[something here]'

Something like this should work for you (someone can probably post a better Regex version - I suck at Regex):
Code:
$route['one/(:any)/(:any)/(:any)'] = 'home';
$route['one/(:any)/(:any)'] = 'home';
$route['one/(:any)'] = 'home';
#4

[eluser]daweb[/eluser]
Thank you guys,

I solved! It was a stupid trick.

Code:
$segments = $this->uri->segment_array();
$last_segment = end($segments);    
$last_key     = key($segments);

[...]

$config_pagination['uri_segment'] = $last_key;

I don't know if it's the best way to do that, but it works for me!




Theme © iAndrew 2016 - Forum software by © MyBB