简体   繁体   中英

Decode RealUrl url in the controller

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.

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()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM