I've just been given a project for a CRM called Kohana, which i've never heard of until now.
Everthing works ok except for controllers that are in a sub folder and when the controller name isn't just a single word.
This controller is in system/expenses.php
<?php defined('SYSPATH') or die('No direct script access.');
class Controller_System_Expenses extends Controller_System {
public $header = 'Expenses';
public function action_index() {
$this->template->content = view::factory('system/expenses/listings');
$this->template->content->expenses = expenses::get_all();
}
public function action_update() {
$expenses = expenses::find_by_id(form::get_value('id'));
expenses::update($expenses, form::data());
$this->redirect(request::current()->referrer());
}
}
When i try to access /system/expenses it gives a 404. If i then move the controller to the base controller folder it still doesn't work unless i rename the class to Controller_Expenses instead of Controller_System_Expenses which then works on the route /expenses
Here is the bootstrap.php file:
Route::set('automate', 'hourly')
->defaults(array('controller' => 'cron',
'action' => 'hourly'
));
Route::set('daily', 'daily')
->defaults(array('controller' => 'cron',
'action' => 'daily'
));
Route::set('auth', '<action>',
array(
'action' => '(login|logout)'
))
->defaults(array(
'controller' => 'auth',
'action' => 'login',
));
Route::set('super', 'system/(<controller>(/<action>(/<id>)))')
->defaults(array(
'directory' => 'system',
'controller' => 'settings',
'action' => 'index',
));
Route::set('default', '(<controller>(/<action>(/<id>)))')
->defaults(array(
'controller' => 'Dashboard',
'action' => 'index',
));
It doesn't matter if i add a route in here specifically for the url, if i remove the "super" route, nothing works in the sub folder, even if i rename the controller to Controller_Expenses inside the "system" controller folder the route i had working of just /expenses still doesn't work.
I'm at a loss of how this is supposed to work.
case sensitive directory/class name:
trailing slash:
defaults for optional parameters: