Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Two or more PathParts chained ( Catalyst )

How can I have more than one pathpart in an action at the same time? I tried with Regex and LocalRegex but it realy doesnt work.

This is the result I want:

/typeone/*/*/something
/typetwo/*/*/something

I want to achieve this by using only one base action that captures the two args in from, and can have either the "typeone" or "typetwo" pathpart.

The "something" is just another action that is chained to that base. I don't want to have two bases with two different pathparts, that would require me to have two something chained to each of the bases, right?

Thank you

like image 465
LuRsT Avatar asked Jun 19 '12 16:06

LuRsT


1 Answers

The common wisdom in the Catalyst community seems to be that chaining is always a better idea than regex matching, these days -- to the extent that some of the regex stuff might get moved out of core in version 6.

Do the examples here help? http://wiki.catalystframework.org/wiki/gettingstarted/howtos/chainedexamples.view
The account/org/*/edit one seems to involve matching 3 separate PathParts...

Each of the relevant subs -- the ones triggered by typeone and typetwo, in your case -- will be run. Or is that not what you're after?

like image 139
James Green Avatar answered Sep 18 '22 13:09

James Green