Open aboutwout opened 12 years ago
That's an excellent idea. Are there other params like that? :string, I'm guessing?
:string would be a bit too broad I guess, since practically anything can be a string... I'd go with :alpha
You can read up on CI's routing options here
Thanks, this is helpful. Will look through their routing system to get a better idea about how Freeway can work.
I did a little bit of thinking and since you need a segment name to use for the {freeway_{name}} variables, you'd have to add the contraints to it.
Something like this:
product/{{product_id:num}}/{{action:alpha}}
Or even incorporate a regex pattern:
`product/{{product_id:(\d+)}}``
– Wouter
Interesting. My original thought would be that if segments had restrictions or special parameters like that, they would look more like:
{{product_id only="num" match="^299.*?$" from="cat_id" to="cat_name"}}
Seems more idiomatic to EE, and provides more flexibility for future features.
Adding this here because I think it also falls underneath URL segment constraints:
Currently the following route: /testroute => /
will match a URL of /testroute, but it will also match /testroute2. Possibly regex anchors could be used to specify the beginning and end of the route to be matched? In my mind my route would end up looking like:
^/testroute/$ => /
Weird — thanks for catching that oversight. Will make sure to anchor the segments between ^ and $.
Hi Doug,
Very nice extension and I can't wait to dig in (when I have a need for it), but there's one thing I'm missing compared to 'normal' routes in CI.
With CI routes you can do something like this:
`$route['product/(:num)'] = "catalog/product_lookup_by_id/$1";``
Which basically says that the 2nd segment has to be a number. Is there any way to incorporate this in Freeway?
– Wouter