Hi.
I've been struggling with the best way to accomplish a somewhat simple task: direct to a specific controller/action based on a code in the uri.
My site is (going to be) a comprehensive entertainment database covering movies, tv shows, books, comics, graphic novels, and even games and posters. Each media type has it's own code...
+-----+--------------------+-------------+
| id | name | description |
+-----+--------------------+-------------+
| mov | Movie | NULL |
| tvs | TV Series | NULL |
| hbo | HBO | NULL |
| mgz | Magazine | NULL |
| bok | Book | NULL |
| bbd | Billboard | NULL |
| gcd | Greeting Card | NULL |
| ptr | Poster | NULL |
| pcd | Post Card | NULL |
| web | Website | NULL |
| tvm | TV Movie | NULL |
| stv | Straight to Video | NULL |
| tms | TV Miniseries | NULL |
| tve | TV Episode | NULL |
and so on. While not a "media type" I also code persons as "prn".
So my url's currently look like /media_type/id ...
Movies ...
Tron: http://www.pausetosee.com/mov/movez9zbefv1fzaq
Event Horizon: http://www.pausetosee.com/mov/mov1ufub4zg1mp2j
TV Episodes ...
Sons of Anarchy : The Pull: http://www.pausetosee.com/tve/tve28or7cin210v3
Chicago Fire : A Problem House: http://www.pausetosee.com/tve/tveeoz58rafdccn5
Persons ...
Robert Downey Jr.: http://www.pausetosee.com/person/prniffqosbaj0h2n
Ron Perlman: http://www.pausetosee.com/person/prnn7ivdbdq8808p
What I'd like to do is have the system direct to the proper controller and action based on the 3 character code in the ID ...
Tron: http://www.pausetosee.com/movez9zbefv1fzaq
Event Horizon: http://www.pausetosee.com/mov1ufub4zg1mp2j
TV Episodes ...
Sons of Anarchy : The Pull: http://www.pausetosee.com/tve28or7cin210v3
Chicago Fire : A Problem House: http://www.pausetosee.com/tveeoz58rafdccn5
Persons ...
Robert Downey Jr.: http://www.pausetosee.com/prniffqosbaj0h2n
Ron Perlman: http://www.pausetosee.com/prnn7ivdbdq8808p
Any suggestions on how to do this? I'm toying with a large switch statement in the root controller and visiting the appropriate controller/action based on the parameter. Is this right? Does Catalyst provide a way to accomplish this either easier or cleaner?
Any help is appreciated.
Thanks,
bill
http://wbhauck.com
I've been struggling with the best way to accomplish a somewhat simple task: direct to a specific controller/action based on a code in the uri.
My site is (going to be) a comprehensive entertainment database covering movies, tv shows, books, comics, graphic novels, and even games and posters. Each media type has it's own code...
+-----+--------------------+-------------+
| id | name | description |
+-----+--------------------+-------------+
| mov | Movie | NULL |
| tvs | TV Series | NULL |
| hbo | HBO | NULL |
| mgz | Magazine | NULL |
| bok | Book | NULL |
| bbd | Billboard | NULL |
| gcd | Greeting Card | NULL |
| ptr | Poster | NULL |
| pcd | Post Card | NULL |
| web | Website | NULL |
| tvm | TV Movie | NULL |
| stv | Straight to Video | NULL |
| tms | TV Miniseries | NULL |
| tve | TV Episode | NULL |
and so on. While not a "media type" I also code persons as "prn".
So my url's currently look like /media_type/id ...
Movies ...
Tron: http://www.pausetosee.com/mov/movez9zbefv1fzaq
Event Horizon: http://www.pausetosee.com/mov/mov1ufub4zg1mp2j
TV Episodes ...
Sons of Anarchy : The Pull: http://www.pausetosee.com/tve/tve28or7cin210v3
Chicago Fire : A Problem House: http://www.pausetosee.com/tve/tveeoz58rafdccn5
Persons ...
Robert Downey Jr.: http://www.pausetosee.com/person/prniffqosbaj0h2n
Ron Perlman: http://www.pausetosee.com/person/prnn7ivdbdq8808p
What I'd like to do is have the system direct to the proper controller and action based on the 3 character code in the ID ...
Tron: http://www.pausetosee.com/movez9zbefv1fzaq
Event Horizon: http://www.pausetosee.com/mov1ufub4zg1mp2j
TV Episodes ...
Sons of Anarchy : The Pull: http://www.pausetosee.com/tve28or7cin210v3
Chicago Fire : A Problem House: http://www.pausetosee.com/tveeoz58rafdccn5
Persons ...
Robert Downey Jr.: http://www.pausetosee.com/prniffqosbaj0h2n
Ron Perlman: http://www.pausetosee.com/prnn7ivdbdq8808p
Any suggestions on how to do this? I'm toying with a large switch statement in the root controller and visiting the appropriate controller/action based on the parameter. Is this right? Does Catalyst provide a way to accomplish this either easier or cleaner?
Any help is appreciated.
Thanks,
bill
http://wbhauck.com