0

i have problem with kohana 3.3.x modules. i am trying to create a module called admin in my kohana project. i followed kohana documents & some samples about it to create one but it seems that something goes wrong :(

this is my module structure :

- modules
   - admin
      - classes
         - Controller
            - dashboard.php
         + Model
      + views
      - init.php

and here is my dashboard.php :

class Controller_Admin_Dashboard extends Controller {
    public function action_index ()
    {
        echo 'module !!!';
    }
} 

and this is what i defined in the init.php :

Route::set('admin', 'admin(/<controller>(/<action>(/<id>)))')
->defaults(array(
    'directory'  => 'admin',
    'Controller' => 'dashboard',
    'action'     => 'index',
));

i also loaded module in the bootstrap.php like this :

'admin'      => MODPATH.'admin',     // Admin Panel

everything is seems ok but when i enter

localhost/cms/admin/dashboard/

in the address bar i will get an error like this. what's going on? please help me.

error :

Kohana_HTTP_Exception [ 404 ]: The requested URL admin/dashboard/ was not found on this server.

1 Answers1

0

'directory' param in route used for subdirectory in 'classes' folder, NOT the module root.

This is correct structure for your route

- modules
    - admin
       - classes
          - admin
             - Controller
                - dashboard.php
       + Model
       + views
       - init.php
MisterX
  • 310
  • 1
  • 4