Skip to content

Support language in URL#10

Open
falkoschumann wants to merge 2 commits into
katgirl:masterfrom
bitctrl:master
Open

Support language in URL#10
falkoschumann wants to merge 2 commits into
katgirl:masterfrom
bitctrl:master

Conversation

@falkoschumann

Copy link
Copy Markdown

I use the core method generateFontendUrl() instead of reading the global
values of rewriteUrl, disableAlias and urlSuffix and build the URL
manually.

I use the core method generateFontendUrl() instead of reading the global
values of rewriteUrl, disableAlias and urlSuffix and build the URL
manually.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can replace all of this

    global $objPage;
    $arrRow = array(
        'id' => $objPage->id,
        'alias' => $objPage->alias
    );
    if (empty($params))
    {
      return $this->generateFrontendUrl($arrRow);
    }
    else 
    {
      $strParams = '/' . implode('/', $params);
      return $this->generateFrontendUrl($arrRow, $strParams);
    }

with:

return $this->generateFrontendUrl($GLOBALS['objPage']->row(), (!empty($params) ? $strParams : null));

Of course you have to pay attention to be in TL_MODE == 'FE' as otherwise objPage will not be available at all.

Thanks to discordier for this hint.
@falkoschumann

Copy link
Copy Markdown
Author

I think this method is only called by frontend code. The backend has an other createUrl(), I do not touched.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants