How to set default module

7 days ago

+
0
-

So, I have this structure:

app/
  BlogModule
    presenters
    templates
  AdminModule
    presenters
    templates
  DefaultModule
    presenters
    templates

I would like to have the Default Module loaded when the site is accessed: eg https://example.com would load the DefaultModule.

Where is the default set?

Thanks
Kevin

7 days ago

CZechBoY
Member | 3298
+
0
-

You should set defaults in RouterFactory.

Something like

$router->addRoute('<module>/<presenter>/<action>[/<id>]', 'Default:Default:default');

6 days ago

+
0
-

Again, thank you good sir.
For those following, the solution is to edit the app/router/RouterFactory.php file so that it looks like this:

<?php

namespace App;

use Nette;
use Nette\Application\Routers\Route;
use Nette\Application\Routers\RouteList;


final class RouterFactory
{
        use Nette\StaticClass;

        /**
         * @return Nette\Application\IRouter
         */
        public static function createRouter()
        {
                $router = new RouteList;
                $router[] = new Route('<presenter>/<action>[/<id>]', 'Default:Default:default');
                return $router;
        }
}