Love Fuel?
Donate
About
Forums
Discussions
Login
FuelPHP Forums
Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
General
Routing Param return URI String
richtestani
February 2013
I am working with the Advanced Routing feature, explained here:
http://fuelphp.com/docs/general/routing.html#/advanced
I have a method named action_single which I want to direct various urls to,
The setup is that based on the depth of the url, the more defined the result would be.
For example, I can go to:
/cards/1989
and get all cards from that year
or
/cards/1989/baseball
and get all cards of baseball from 1989 and so forth.
Here are my routes:
'cards/:year' => 'cards/single',
'cards/:year/:manufacturer' => 'cards/single',
'cards/:year/:manufacturer/:genre' => 'cards/single',
'cards/:year/:manufacturer/:genre/:set' => 'cards/single',
'cards/:year/:manufacturer/:genre/:set/:person' => 'cards/single',
'cards/:year/:manufacturer/:genre/:set/:person/:card' => 'cards/single'
If I head over to the url:
/cards/1989/topps/baseball
then echo $this->param('year')
it yields: 1989/topps/baseball
And all other params output 0.
Any ideas whats happening here?
I originally thought I could use a single route but I get missing pages if the urls dont match.
Thanks
Rich
Harro
February 2013
Accepted Answer
Routes are processed in the order in which they are defined.
Like this, a URI like "/cards/1989/topps/baseball" will be matched by the first route, '
cards/:year'.
Reverse them, always start with your most specific routes.
richtestani
February 2013
Thank you!
Add a Comment
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Apply for Membership
Categories
All Discussions
5,088
General
↳ General
3,364
↳ Job Board
13
↳ Installation & Setup
214
Packages
↳ Oil
213
↳ Orm
700
↳ Auth
260
Development
↳ Tips and Tutorials
126
↳ Code share
145
↳ Applications
52
In this Discussion
Harro
February 2013
richtestani
February 2013