Hi!
Like I said before, I'm quite into Framework at the moment.
Anyhow, something's wrong with my routes function, because.. it works GREAT when I'm on this url:
localhost/index.php/controller/index/
but not
localhost/index.php/controller/index
It has to end with a trailing slash, or else I get this:
Code:
Notice: Undefined index: 3 in C:\wamp\www\testproject\system\libraries\Router.php on line 33
Router.php:
PHP Code:
public function route()
{
if($this->uri['1'] == '') // If the first URI segment is blank
{
$default_controller = TANAXIA_CORE::config_item('default_controller');
Tanaxia_Loader::controller($default_controller);
}
elseif($this->uri['2'] == '')
{
Tanaxia_Loader::controller($this->uri['1']);
}
elseif($this->uri['3'] == '')
{
Tanaxia_Loader::controller($this->uri['1'], $this->uri['2']);
}
else
{
Tanaxia_Loader::controller($this->uri['1'], $this->uri['2'], $this->uri['3']);
}
}
And the controller in Loader:
PHP Code:
public function controller($controller, $function = NULL, $params = NULL)
{
if(!file_exists(APPPATH . 'controllers/' . $controller . EXT))
{
TANAXIA_CORE::error('Could not locate the controller "' . $controller . '"');
}
include(APPPATH . 'controllers/' . $controller . EXT);
$name = ucfirst($controller) . "Controller";
$class =& new $name();
if($function === NULL)
{
return $class->index();
}
elseif($params !== NULL)
{
return $class->$function($params);
}
else
{
return $class->$function();
}
}
Any suggestions on how to fix so I can get rid of that error?
Thanks