The generateFrontendUrl hook is triggered when a front end URL is recreated. It passes the page object, the parameter string and the default URL as arguments and expects a string as return value.


from Contao 2.5.8.


  1. array $arrRow

    The result row from tl_page to generate the URL from.

  2. string $strParams

    Additional parameters to add between page alias and URL suffix.

  3. string $strUrl

    The URL generated by Contao.

Return Values

The return value should be the URL. If you do not need to alter it (e.g. based on some tl_page condition), just return $strUrl.



// config.php
$GLOBALS['TL_HOOKS']['generateFrontendUrl'][] = array('MyClass', 'myGenerateFrontendUrl');

// MyClass.php
public function myGenerateFrontendUrl($arrRow, $strParams, $strUrl)
    return str_replace('.html', '.xml', $strUrl);

More information


See also

results matching ""

    No results matching ""