[TYPO3-50-general] Need help with Routing

Bastian Waidelich bastian at typo3.org
Mon Feb 16 19:00:58 CET 2009


Christoph Blömer wrote:

Hi Christoph,

I've finally committed the Routing changes as you can read in the most 
current thread.
With the current architecture it's quite easy to achieve what you need:

Let's say you have a package "WebDAV". Just create a subfolder 
"RoutePartHandlers" and the WebDAVRoutePartHandler.php:

declare(ENCODING = 'utf-8');
namespace F3\WebDAV\RoutePartHandler;

class WebDAVRoutePartHandler extends 
\F3\FLOW3\MVC\Web\Routing\DynamicRoutePart {

	protected function findValueToMatch($requestPath) {
		return $requestPath;
	}
}

And than add a Route at the end of the global Routes.yaml:

WebDAV:
   uriPattern: 'webdav/{path}'
   defaults:
     @package:    'WebDAV'
     @controller: 'Default'
     @action:     'index'
   routePartHandlers:
     path: 'F3\WebDAV\RoutePartHandler\WebDAVRoutePartHandler'

if you want the path to be optional, it should be something like:

WebDAV:
   uriPattern: 'webdav(/{path})'
   defaults:
     @package:    'WebDAV'
     @controller: 'Default'
     @action:     'index'
     path:        '/'
   routePartHandlers:
     path: 'F3\WebDAV\RoutePartHandler\WebDAVRoutePartHandler'


Obviously the RoutePartHandler above is not really WebDAV-related. All 
it does is storing the part of the request Path that haven't been 
matched yet.
But you could easily improve it. Just have a look at the parent Class 
DynamicRoutePart. And don't hesitate to post if you have further questions!

good luck,
Bastian


More information about the TYPO3-project-5_0-general mailing list