May I look at example or step-by-step instruction to do a module in routed mode?
As I read in docs fuel must automaticaly detect, when first segment match module name. Is it?
I create the module Admin, create class/controller/admin.php:
namespace Admin;
class Controller_Admin extends Controller_Template { public function action_index() { ...} }
1. What I have to do for invoking index action with request http://localhost/public/admin/admin/index? 2. What I have to do for invoking index action with request http://localhost/public/admin? 3. May I set routing for module like 'admin/(:any)' for invoking any actions of Admin class? 4. May I set routing for module like 'admin/user/(:any)' for invoking any actions of User class (when I create it)?
The Fuel router will try to match the first segment against a define module, and if a match is found, load it. It will only do that if there was NO route patch though, so with your admin example, if your app routes.php would contain a route starting with 'admin/', that would be matched first.
As you your questions:
1.nothing, that would resolve automatically 2. 'admin' => 'admin/admin/index'; or 'admin' => 'admin/admin' 3. That would need a route 'admin/(:any)' => 'admin/admin/$1' 3. That would need a route 'admin/user/(:any)' => 'admin/admin/user/$1'
Note that route 3 would not be matched by http://localhost/admin, since that route has the trailing slash as required. If you want to have it optional, it needs to be inside the brackets. Same applies for 4.
Passing index is optional, if no method is detected in the URL (in case of "admin/admin" for example), it will assume you would want to call the index method.