controllerrouteskohanasubdirectorykohana-2

How to access controllers from sub directory in kohana 2.3.4?


I'm developing a new website in kohana2.3.4. I have created a folder called admin in controllers. I have a controller file main.php in application/controllers/admin/main.php. How to call this controller in kohana2.3.4? Is any routes need to be defined in routes.php? I have added following in routes.php.

$config['admin/login.html'] = "admin/main/login";

But it shows error as "The requested view, _error/404, could not be found". What is the error and how to call a controller that exists inside a controllers/subfolder in kohana 2.3.4?


Solution

  • Sorry.. I found the answer. (Module or Controller ) name / Function name / Variables 1 / Variable 2 / .... This is the format . What ever sub folder it is , just give the controller name .Its enough. We can set the route in routes.php like,

    $config['admin/login.html'] = "admin/main/login";