Question

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/home/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.

Was it helpful?

Solution

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.

OTHER TIPS

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);      
    }      
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top