• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help With URLs

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:


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?

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).

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.