Welcome Guest, Not a member yet? Register   Sign In
URI Routing
#6

[eluser]jedd[/eluser]
Okay .. well, here's what I might do (I use that caveat because I'd probably ponder it for a while, and there's obviously a lot more to it than you can describe in a few paragraphs).

I'd have a controller called Team.

I'd have a method in there called show

That method would be declared like this:
Code:
function  show  ( $team_name = NULL , $year = NULL )

This means that if you took a URL like this: http://www.example.com/team/show/bulls/1993 then your $team_name would be set to 'bulls' and $year would be set to 1993.

I often try to think of the first parameter (the controller name) as the noun, and the second (the method or function) as the verb. And after that you just try to start with the most-significant-data and ascend down through data of lesser significance.

You sometimes find you want to set up a pairing approach - url's that end up with, say, ../name/bulls/year/1993 ... but that's a bit more complex, and works better when you have a large set of *possible* variables you want to transfer, but don't usually send all variables around. With your situation, context is fairly consistent. If this paragraph doesn't make sense, feel free to ignore it.


Messages In This Thread
URI Routing - by El Forum - 08-23-2009, 08:39 PM
URI Routing - by El Forum - 08-24-2009, 02:46 PM
URI Routing - by El Forum - 08-24-2009, 06:55 PM
URI Routing - by El Forum - 08-24-2009, 07:26 PM
URI Routing - by El Forum - 08-24-2009, 07:37 PM
URI Routing - by El Forum - 08-24-2009, 07:50 PM
URI Routing - by El Forum - 08-24-2009, 07:58 PM
URI Routing - by El Forum - 08-25-2009, 05:20 AM



Theme © iAndrew 2016 - Forum software by © MyBB