[eluser]davewilly[/eluser]
Hey guys, I'm finding it a bit of a messy affair dealing with multiple params on a site I'm rebuilding in CI.

I have a URL like www.site.com/stag-do/bristol/packages/1 and have been struggling to handle it in a clean manner without some ugly if/elseif. I had thought it would be a case of a nice switch statement. I've had to cascade if/elseif statement, with what I would consider the wrong logical flow to handle it.

My psuedo code is this:

if a package (ie. /1, /2 etc) param is set
---- Test it in a switch and display package details page
elseif packages segment isset and is equal to 'packages'
---- Show the packages page
elseif location segment is set, and location segment is equal to 'bristol' and packages segment is not set..
---- Show location page
else
---- 404

I would really appreciate if someone has a better solution. Perhaps this is more of a general PHP questions opposed to a CI specific question!

Here is code from my controller, the method I am refering to is bristol()

[eluser]mddd[/eluser]
If I get you correctly, there are basically 3 pages:
1- a page to show info about a city
2- a page to show a list of packages
3- a page to show info about a specific package.

I would make the urls as short as possible, like so:
/stag-do/bristol : show page type 1
/stag-do/bristol/packages : show page type 2
/stag-do/bristol/2 : show page type 3 (if you like this could also be /stag-do/bristol/packages/2 but why make it longer than neccessary)

You could do all the checking in your _remap function in the stag_do class: