[FLOW3-general] Re: Re: Sub folder in Controller

Cornel Widmer cornel at kollerinternet.ch
Fri Mar 15 16:24:16 CET 2013


Hi Bastian

Finally it works! Thanks for your advice. It seem like I didn't try this combination of Back- and forwardshlashes ... :-/

Maybe you can give me one more tipp. I ended up with this two routes in my Routes.yaml.

-
  name: 'Administration User'
  uriPattern: '{@package}/administration/user/{@action}'
  defaults:
    '@package': 'WS.Rico'
    '@controller': 'Administration\User'
    '@action': 'index'

-
  name: 'Administration Checklist'
  uriPattern: '{@package}/administration/checklist/{@action}'
  defaults:
    '@package': 'WS.Rico'
    '@controller': 'Administration\Checklist'
    '@action': 'index'


As you see, I got a little bit into it with the variables in the pattern. But as there will be many, many more Controllers I would ask: is there a way to catch all subControllers with one route?


Best regards,
Cornel


Quote: Bastian Waidelich wrote on Fri, 15 March 2013 15:49
----------------------------------------------------
> Cornel Widmer wrote:
> 
> Hi Cornel,
> 
> 
> > In my controller folder I want the subfolder "Administration" with many
> > more controllers. [...]
> 
> > -
> >   name: 'Administration'
> >   uriPattern: 'administration\user'
> >   defaults:
> >     '@package': 'WS.Rico'
> >     '@controller': 'Administration/User'
> >     '@action': 'index'
> 
> 
> Your uriPattern contains a backslash and the @controller default value a 
> forward slash. Try:
> 
> 
> -
>   name: 'Administration'
>   uriPattern: 'administration/user'
>   defaults:
>     '@package': 'WS.Rico'
>     '@controller': 'Administration\User'
>     '@action': 'index'
> 
> 
> A different solution would be the use of "SubPackages". For this to 
> work, the directory structure should be:
> 
> Classes
>    Your
>      Package
>        Controller
>        Administration
>          Controller
> 
> And the respective route:
> 
> -
>   name: 'Administration'
>   uriPattern: 'administration/user'
>   defaults:
>     '@package': 'WS.Rico'
>     '@subpackage': 'Administration'
>     '@controller': 'User'
>     '@action': 'index'
> 
> (untested)
> 
> 
> Also, always make sure to check the log, it contains details about the 
> failing routes!
> 
> -- 
> Bastian Waidelich
> --
> Core Developer Team
> 
> TYPO3 .... inspiring people to share!
> Get involved: typo3.org
----------------------------------------------------




More information about the FLOW3-general mailing list