Welcome Guest, Not a member yet? Register   Sign In
Possible to pass variables to index via second URI rather than third?
#1

[eluser]randomdriver[/eluser]
I am just curious if there is a way to pass a variable via the second param in the URI and not have it read/look for the function in a class.

So it would be:

mysite.com/someclass/page1

It would then just load the index function in that class. So I could have:

mysite.com/someclass/page1
mysite.com/someclass/page2

Etc. I think this keeps it cleaner than mysite.com/someclass/index/page1

Thanks!
#2

[eluser]CroNiX[/eluser]
You can use the remap function or a custom route.
#3

[eluser]tonanbarbarian[/eluser]
the problem doing what you are trying to do is you are pretty much limiting yourself to a single method in the controller
but what you want to do should be possible if you use the _remap method in the controller
http://ellislab.com/codeigniter/user-gui...#remapping
#4

[eluser]randomdriver[/eluser]
Thanks. About 2 minutes after posting this I found you can edit the routes.php file in the config folder. Is this what you meant?
#5

[eluser]randomdriver[/eluser]
[quote author="tonanbarbarian" date="1289302642"]the problem doing what you are trying to do is you are pretty much limiting yourself to a single method in the controller
but what you want to do should be possible if you use the _remap method in the controller
http://ellislab.com/codeigniter/user-gui...#remapping[/quote]

Actually, for anyone trying to do what I am here is the solution:

in routes.php just added

$route['^controller/page(:num)'] = 'controller/method/$1';

This will allow you to still have multiple methods and not always have controller/method/1




Theme © iAndrew 2016 - Forum software by © MyBB