Welcome Guest, Not a member yet? Register   Sign In
Trouble With Routes
#1

[eluser]Bl4cKWid0w[/eluser]
I am trying to make a clan ladder site. I want the url to be like the following example:
mysite.com/ladders/xbox-360/halo-3/team-slayer

I have the ladders controller. The second uri segment would be the "console" function and the the third segment would be the game function. The fourth segment would be the ladder function.

These are my routes:
Code:
$route['ladders/:any'] = "ladders/console";
$route['ladders/console/:any'] = "ladders/console/gameview";
$route['ladders/console/gameview/:any'] = "ladders/console/gameview/ladderview";

The index function lists all the consoles that the site supports.

The console function lists all the games under the console that the user previously selected at the index page.

The game function lists all the ladders under the game that the user previously selected at the console page.

The ladder function lists all the clans under the ladder that the user previously selected at the game page.

The index function works fine as does the console function, but when I click on a game link, nothing happens even when the url is ladders/xbox-360/halo-3/team-slayer
#2

[eluser]narkaT[/eluser]
how about:
Code:
$route['ladders(:any)'] = "ladders/display$1";

and
Code:
class Ladders {
    //...

    function display($console = null, $game = null, $team = null) {

        switch(null) {
            case !empty($console):
                //console overview
                break;
            case !empty($console) && !empty($game):
                //game overview
                break;
            case !empty($console) && !empty($game) && !empty($team):
                //team stats
                break;
            default:
                //general overview
                break;
        }

    }
}

just an idea Wink
#3

[eluser]Bl4cKWid0w[/eluser]
Will that be usable with the pretty urls?
#4

[eluser]Aken[/eluser]
Reverse the order your rules are in. The most specific ones should go first, and the most generic ones last.
#5

[eluser]narkaT[/eluser]
[quote author="Bl4cKWid0w" date="1226040572"]Will that be usable with the pretty urls?[/quote]

that's what it is meant for Wink




Theme © iAndrew 2016 - Forum software by © MyBB