We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

How to route: https://dmoain/module/controller/action.html/en



4.7k
edited Apr '15

Try this:

$router->add('/:module/:controller/([a-z]+)\.(json|html)/([a-z]{2})', array(
    'module' => 1,
    'controller' => 2,
    'action' => 3,
    'type' => 4,
    'country' => 5
));

Hi, i did that, and works!, but i have a problem!... this is url:

https://feedback/public/common/changelanguage.html/en

and in the controller:

public function changeLanguageAction($lang = NULL) {
    echo $lang;
    die();
    $this->view->disable();
    $this->_fnChangeLanguage($lang);
}

echo $lang: must be: en but show: n

Help!



25.4k
Accepted
answer

I fixed muy problem!....

https://feedback/public/common/changelanguage.html/parameters

https://feedback/public/common/changelanguage.html/en

https://feedback/public/common/changelanguage.html/etc

    $router->add('/:module/:controller/([a-z]+)\.(json|html)/:params', array(
    'module' => 1,
    'controller' => 2,
    'action' => 3,
    'type' => 4,
    'params' => 5
));