Welcome Guest, Not a member yet? Register   Sign In
Re-routing into controller and function
#1

[eluser]Unknown[/eluser]
Hello,
is there any nicer way how to achieve the following?
I need to call main/admin_comments in both cases - when there are no variables, when there are 1 or 2 variables.
The following works for no variables and for two.

$route['admin/mycomments/(:any)/(:num)']="main/admin_comments/$1/$2";
$route['admin/mycomments']="main/admin_comments";

function admin_comments($action=null,$id=null)
{
if(!is_null($action))
{
//aciton
}
//nothing
}

This solution works, however, I am curious if it can be done easier.

Thanks in advance,
Meereck




Theme © iAndrew 2016 - Forum software by © MyBB