Decode RealUrl url in the controller

928 views Asked by At

I use RealUrl for my website. In my certain extension, I require to decode the url created by RealUrl to the normal TYPO3 url format.

Example:

To my controller I get this link : typo3website/feature/number/123 , now how do I convert this to typo3website/index.php?id=99&number=123

The RealUrl does not use namespace, and hence i'm unable to understand how to create an instance of the class tx_realurl.

I tried using require_once(PATH_typo3conf.'ext/realurl'.'/class.tx_realurl.php'); and creating new instance of tx_realurl, but gives a class not found error.

1

There are 1 answers

3
lorenz On BEST ANSWER

If RealURL is configured properly and the link is generated with the uriBuilder or the ActionViewHelper, you don't need to take care of that. If we take your example and you configured RealURL to use typo3website/feature/number/123 for index.php?id=99&tx_yourext[number]=123, you can use this as argument for your action:

public function showAction($number) {
}

You can also access all arguments from a controller action by using

$this->request->getArguments()