Multi-module Router Problem

I have a virtual host dev.phalcon.com http://dev.phalcon.com/sample default router : index/sample/index but I want to set http://dev.phalcon.com/sample default router as sample/index/index

In other words,there is only one http://dev.phalcon.com/sample ,sample is module name. But Now sample is Controller name



34.3k

in router $router->setDefaultModule("frontend"); $router->setDefaultAction("index"); $router->setDefaultController("index");



11.5k

I have two Module, sample1 ,sample2 $router->setDefaultModule("sample1");

But http://dev.phalcon.com/sample2 ,I get some error: Fatal error: Uncaught exception 'Phalcon\Mvc\Dispatcher\Exception' with message 'Multiple\Sample1\Controllers\Sample2Controller handler class cannot be loaded'



11.5k

http://dev.phalcon.com/sample2 default router is sample1/sample2/index Not the router sample1/index/index



34.3k
edited Oct '14

I have two module frontend, admin, my in router

$router->removeExtraSlashes(true);
/*===========================Frontend=====================================*/
            $router->setDefaultModule("frontend");
            $router->setDefaultAction("index");
            $router->setDefaultController("index"); 

/*=============================Backend====================================*/
            $router->add("/admin", array(
                'module' => 'admin'

            ));
            $router->add('/admin/:controller', array(
                'module' => 'admin',
                'controller' => 1,
                'action' => 'index',
            ));

            $router->add('/admin/:controller/:action', array(
                'module' => 'admin',
                'controller' => 1,
                'action' => 2,
            ));
            $router->add(
                "/admin/:controller/:action/:params",
                array(
                'module' => 'admin',
                    "controller" => 1,
                    "action"     => 2,
                    "params"     => 3,
                )
            );


11.5k

$router = new \Phalcon\Mvc\Router();

$router->setDefaultModule("sample1");

$router->add('/:module/:controller/:action', array( 'module' => 1, 'controller' => 2, 'action' => 3, ));



11.5k

http://dev.phalcon.com/sample2 default router is sample1/sample2/index Not the router sample1/index/index

Not Work ,Why



11.5k

Now I am writing a framework base phalcon, Module name is user-defined.