Multiple module route issue
Reported by Nesbert in Google Groups.
Hey Guys,
First off really enjoying PHP again thanks to Phalcon!!!
I am trying to set up a multiple module site and was wondering why the following is routes are not working. You can view my bootstrap file at https://gist.github.com/3701633 line #86. I basically have two modules so far and would like the second routed automatically like the first route.
Thanks for any help you guys can provided!
Cheers,
Nesbert
Additional information:
Hi there, I believe issue is the framework is still routing to the first module. Attached is the exception I am getting along with additional information. I am probably not setting up the routes properly or that my understanding is wrong. :)
Thanks!
URL: http://localhost/knode/admin/users
Phalcon\Mvc\Dispatcher\Exception Object ( [message:protected] => Knode\Portal\Controllers\AdminController controller class cannot be loaded [string:Exception:private] => [code:protected] => 0 [file:protected] => /Users/nhidalgo/Sites/knode/public/index.php [line:protected] => 104 [trace:Exception:private] => Array ( [0] => Array ( [function] => _throwDispatchException [class] => Phalcon\Mvc\Dispatcher [type] => -> [args] => Array ( [0] => Knode\Portal\Controllers\AdminController controller class cannot be loaded )
)
[1] => Array
(
[function] => dispatch
[class] => Phalcon\Mvc\Dispatcher
[type] => ->
[args] => Array
(
)
)
[2] => Array
(
[file] => /Users/nhidalgo/Sites/knode/public/index.php
[line] => 104
[function] => handle
[class] => Phalcon\Mvc\Application
[type] => ->
[args] => Array
(
)
)
[3] => Array
(
[file] => /Users/nhidalgo/Sites/knode/public/index.php
[line] => 162
[function] => main
[class] => Application
[type] => ->
[args] => Array
(
)
)
)
[previous:Exception:private] =>
)
DocumentRoot: ~/Sites
nhidalgo@nesberth:Sites $ tree knode knode ├── apps │ ├── admin │ │ ├── Module.php │ │ ├── controllers │ │ │ ├── BaseController.php │ │ │ ├── IndexController.php │ │ │ └── UsersController.php │ │ ├── models │ │ └── views │ │ ├── index │ │ │ └── index.phtml │ │ └── users │ │ └── index.phtml │ └── portal │ ├── Module.php │ ├── controllers │ │ ├── BaseController.php │ │ ├── IndexController.php │ │ └── LoginController.php │ ├── models │ └── views │ ├── index │ │ └── index.phtml │ ├── layouts │ │ ├── login.phtml │ │ └── portal.phtml │ └── shared ├── library │ └── Acl.php ├── public │ ├── errors │ │ ├── 401_unauthorized.phtml │ │ ├── 403_forbidden.phtml │ │ ├── 404_not_found.phtml │ │ └── 500_error.phtml │ ├── index.php │ └── static │ └── js │ └── app.js ├── tests │ └── library └── vendor
Looks there might not be an issue but a miss understanding on my part. I was making assumptions based on experience with other frameworks. Below is a list of URLs that should hit my second module.
- http://localhost/knode/admin
- http://localhost/knode/admin/users
- http://localhost/knode/admin/users/index <- works
I was getting the previous error from URLs 1 and 2. I guess my question is there a way to set up a default controller and action for a module?
- http://localhost/knode/admin -> ../apps/admin/controllers/IndexController::indexAction
- http://localhost/knode/admin/users -> ../apps/admin/controllers/UsersController::indexAction
Please close... see https://groups.google.com/forum/#!topic/phalcon/lwjCboIrGqM or https://gist.github.com/3701633#L88
Thanks!