开发者

TYPO3: getTypoLink_URL alternative (generating url aliases)

Is there an alternative way of getting the URL to a page (by id) apart from using cObj->getTypoLink_URL?

I'm trying to create URL aliases, so a page can have multiple URLs (for example "/about" could actually point to "/corporate/hom开发者_运维百科e/about").

I'm currently hooking into realurl's hook decodeSpURL_preProc, but TSFE and cObj are not initialised at that point therefore calling cObj->getTypoLink_URL doesn't work.

I should add that the url alias should not redirect to the original url.


If you create RealURL aliases("Redirects"), you can create a database query that fetchs the url aliases, you have created.

Have a look in the realurl redirects table.


just use the folowing code to generate the link.

You might want to load localconf.php.

class Devlib {

    static function _link($id,$urlParameters='',$target='') {
        $cObj = t3lib_div::makeInstance('tslib_cObj');
        return $cObj->getTypoLink_URL($id,$urlParameters,$target);      
    }      
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜