Welcome Guest, Not a member yet? Register   Sign In
Help with URI and routes file entries.
#1

[eluser]halwaraj[/eluser]
Hi,
I have the following entries in the routes file.

Code:
$route['register']="ts_Register_Controller/doRegister";

This means whatever requests come to /register, it would be routed to the ts_Register_Controller class and to doRegister function under it.

Now, after that request I have the next Request to be sent to /register/insertDetails URL.

I have an echo statement in the insertDetails function in ts_Register_Controller but it does not show in page.

The request doesnt seem to be going to the right function. What can I do to resolve this?
#2

[eluser]xwero[/eluser]
your route only catches the site.com/register url request. You need to do something like
Code:
$route['register/(.+)'] = 'ts_Register_Controller/$1';
$route['register']="ts_Register_Controller/doRegister";
#3

[eluser]halwaraj[/eluser]
Hi thr,

That worked, please can you explain more abt the following LOC you wrote:

Code:
$route['register/(.+)'] = 'ts_Register_Controller/$1';
#4

[eluser]xwero[/eluser]
Routes are no more than an array that is checked by a regex function. So 'register/(.+)' catches all requests that start with register/ and are followed by 1 or more characters. the $1 variable returns the result of the caught characters after register/.




Theme © iAndrew 2016 - Forum software by © MyBB