The router file is located in the template root folder. This file is to set URL logic and call modal, view and controller classes. The router logic is using regular expressions.


 * Usage (RegEx):
 * Find all, string number: [^/]+
 * IF match or else: (match|elseMatch)
 * Can be used as bellow, this will first search for "sibling param" if not just use "/":
 * {page:(?:.+/|/)vara-bilar}
 * OK: "/page1/page2/vara-bilar"
 * OK: "/vara-bilar"
 * Add a dynamic route from pages
 * /{page:.+}/{id:\d+}/{permalink:bil-[^/]+}
 * OK: "/page1/page2/12/bil-volvo"
 * /{id:id-\d+}
 * OK: /id-12

Pages (In order)

You can load every one in router file if you do not know how to use.

1. Load startpage (using regular pages)

$route->addRoute("GET", '/', ['template\modals\pageModal:single', 'template\controllers\pageController:get', 'template\views\pageView:output']);

2. If you want to add a search page

$route->addRoute("GET", '/{search:search}', ['template\modals\searchModal', 'template\controllers\searchController:get', 'template\views\searchView:output']);

3. If you want to add public form action functionality

$route->addRoute("POST", '/{action:post}[/{page:.+}]', ['template\modals\pageModal:single', 'template\controllers\pageController:formSubmit', 'template\views\pageView:json']);

2. Load rest of the pages

$route->addRoute("GET", '/{page:.+}', ['template\modals\pageModal:single', 'template\controllers\pageController:get', 'template\views\pageView:output']);