[Owncloud] URLRouting was: Re: GSoC 2012 Ideas page: time to add those ideas!

Bart Visscher bartv at thisnet.nl
Sun Mar 4 16:35:48 UTC 2012


On Sun, Mar 04, 2012 at 02:46:26AM +0100, Roland van Laar wrote:
> 2) A way to define regex based url patterns:
> 
> urls.php:
> $urlPatterns = Array(
>     Array('url' => '@^/$@', 'function' => 'index.php'),
>     Array('url' => '@^/files@', 'url_include' => 'files/urls.php')
> );
> 
> files/urls.php:
> $urlPatterns = Array(
>     Array('url' => '@^/$@', 'function' => 'index.php'),
>     Array('url' => '@^/download$@', 'function' => 'download.php')
> );
> 
> In file 'urls.php':
> The second line defines the '/' pattern to call the index.php.
> The 'function' key can be either a file (for now) or a function in
> the future.
> The third line defines that when the url is '/files/whatever' the
> urls file: 'files/urls.php'
> is included.

I would use 'function' for a PHP callable, and use 'file' or so for the
.php file reference above.

> 
> When this works, it would be possible to add more functionality,
> such as name based urls:
> Array('url' => ' @^/$@', 'function' => 'index.php', 'name' => 'rootIndex')
> with a resolve function e.g. getUrlByName that returns a
> url based on the name.

for this maybe do 'name' => Array() ?

Bart



More information about the Owncloud mailing list