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

[eluser]sojic[/eluser]
I need url structure: /class.method/param1/value1/param2/value2/format/formatValue

Any hint how to handle this?
#2

[eluser]WanWizard[/eluser]
I think this will work:
Code:
$route['(.+?)\.(.+?)/(.*)'] = '$1/$2/$3';
#3

[eluser]sojic[/eluser]
I need something else

I need restfull url /class.method/param1/value1/param2/value2 so I need to rewrite into param1=value1&param2=value2 or...

function method($param1, $param2)

So... what if somebody call /class.method/param2/value2/param1/value1

Here is example

user.list/category/software/page/2 is same with
user.list/page/2/category/software
#4

[eluser]techgnome[/eluser]
Maybe it's just me... but people shouldn't just be able to call methods any old way they want... there has to be some kind of rule that needs to be enforced at some point. Otherwise you'll end up driving yourself with endless what ifs... I've seen it happen... never pretty. Even a car enforces rules at some point, you can't just shift gears unless first disengaging the clutch.

-tg
#5

[eluser]pickupman[/eluser]
How about leaving your parameters out of the arguments for your method. Call them from inside the method by using:
Code:
function method(){
  $params = $this->uri->uri_to_assoc();
  //or
  $params = $this->uri->ruri_to_assoc(); //for routed uri
}

Now you've got a set of key=>value pairs to use to your liking.
#6

[eluser]kainadolf[/eluser]
It is likely to other variable or function definition. I could see from my code provides an example, you should want to use bases, in addition to showing you the route it may be a route map to the other route. You can easily replace the "MyModule's / mycontroller / ([0-9] +)" to "([a, miscellaneous - Z of ]+)/([ a miscellaneous - Z of ]+)/([ 0-9] +) "and then map 1 to module 2 to the controller.




Theme © iAndrew 2016 - Forum software by © MyBB