+30.2152151245-8 abuse@cms39.com

Every page has a URL with its language and the path of its parents: /en/docs/routing.html. Opening /docs/routing.html without a language returns a 301 to the main language.

Content URLs

echo permalink(48);                    // /en/features.html in the page language
echo cms39_route_name();               // name of the current route
echo cms39_route_param('lang');        // a route parameter

Your own route

From a plugin or theme, with the cms39_routes filter. A route can point to a site page, a file or a function:

add_filter('cms39_routes', function (array $routes) {
    // [methods, pattern, target, name]
    $routes[] = ['GET', '/[lang:lang]/newsletter/[subscribe|unsubscribe:action]',
        ['load' => 'page', 'page_id' => 'mbletter_page_id'], 'mbletter'];
    $routes[] = ['GET', '/[lang:lang]/api/stock/[i:id]', ['handler' => 'my_stock_json'], 'my_stock'];
    return $routes;
});

$url = cms39_route_generate('my_stock', ['lang' => CURRENT_LANG, 'id' => 15]);

Your routes are matched before site pages, so nothing needs to change in config.php.

for more information contact us by
E-MAIL or by phone at (+30) +30.2152151245-8