Welcome Guest, Not a member yet? Register   Sign In
Routes
#1

[eluser]Fr3aked0ut[/eluser]
Hey, I am trying to create a pagination on my page but I want the default URL won't contain a page parameter. I mean, let's say I have an index page with 30 posts. I want each page will contain 5 posts, so this means there will be 4 pages. I want the first page will be
http://example.com
But the second page will be
http://example.com/5

Here's my route:
$route['post/(:num)-(:any).html/(:num)'] = 'pages/post/$1/$2/$3';

$3 is the page number.

Thanks in advance.
#2

[eluser]Fr3aked0ut[/eluser]
Someone?
#3

[eluser]Zack Kitzmiller[/eluser]
Sidenote: Why .html in the route?

Eitherway, if your route starts with 'post' then your urls have to have 'post' in them.

Your example that says http://example.com/5 would need a route like:

Code:
$route['(:num)'] = 'pages/post/$1';

The route you posted would have a URL that looks like

http://example.com/post/123-something.html/123
#4

[eluser]Fr3aked0ut[/eluser]
I know, but if im doing this in your way so http://example.com/post/123-something.html won't work. You know what I mean? I want the first page to be a "native" URL, without the page number.
#5

[eluser]evolutionxbox[/eluser]
If you're using CI, how are you using html files?
#6

[eluser]Fr3aked0ut[/eluser]
Someone? Please? It is really important for me.. Sad




Theme © iAndrew 2016 - Forum software by © MyBB