Welcome Guest, Not a member yet? Register   Sign In
Help With URLs
#1

[eluser]Bl4cKWid0w[/eluser]
I'm developing a custom ladder script. I am having trouble with the URL/controllers. I have made a page for the consoles with links leading to a page with the selected consoles games.

mysite.com/ladders/ -- console list
mysite.com/ladders/console/xbox-360 -- game list

Both of these pages are under a controller called ladders.php. The console list is the index for ladders and the game list is under a function called console. Now for the game, I want the url to be the following example:

mysite.com/ladders/console/xbox-360/halo-3

The only problem is that the halo-3 would be a generated page under a function called "game". Would there be any way to rewrite the segment halo-3 to that function?
#2

[eluser]gon[/eluser]
You can add a route as explained in the Routes page on the CI manual.

Another solution is detecting the number of parameters that get to the console function. If you get one parameter, that should be the console name, and you can call another function game_list(). If 2 params are passed to console, then the first is the console and the second the game. So you can call a function show_game($console, $game).




Theme © iAndrew 2016 - Forum software by © MyBB