Welcome Guest, Not a member yet? Register   Sign In
Problem with autorouting
#1

[eluser]Reaven[/eluser]
Hi everybody

My throuble its with "automatic" routing ...or something similar..

I have this function

public function editComplement($refItem = false)

And in routes file

'admin/complements/edit/(:num)' => 'paneldegestion/editComplement/$1',

The server is "passing" the param (:num) as "refItem" in function editComplement.

The uri mydomain.com/admin/complements/edit/1 sets var $refItem value like the four element on the URL, in this case the number one, when really should be "false".

Sorry for "spaninglish" Smile.

I don't have idea why codeignater it's doing that... in my local works fine but in test server do that.

Any idea?

Thanks!
#2

[eluser]Reaven[/eluser]
Ok i found it

Codeignater core calls functions with call_user_func_array and always uses the uri->rsegments ( > 2) as params for function. then my function have 1 param and CI sets its with uri->rsegment[3] value ...




Theme © iAndrew 2016 - Forum software by © MyBB