Question about routes |
[eluser]Unknown[/eluser]
Hello there, I´m new to this forum. I´m not an experienced user of Code Igniter. There is a gallery on my site. I´m using one-to-one relationship between a URL string and its corresponding controller class/method. For example, http://www.mywebsite.com/gallery/2013-1. Can somebody tell me how can I do sometning like this: http://www.mywebsite.com/gallery/2013/1? I´m sorry for my bad English, but this is not my born language.
[eluser]ivantcholakov[/eluser]
Within application/config/routes.php add: Code: $route['gallery/(:num)/(:num)'] = 'gallery/index/$1/$2'; Within your gallery controller put the following for testing: Code: // This gives an idea how to retrieve the necessary parameters. This is the approach job to be done, maybe I am not precise for your particular case.
[eluser]CroNiX[/eluser]
@ivantcholakov - you can also retrieve them as parameters to your function. Code: $route['gallery/(:num)/(:num)'] = 'gallery/view/$1/$2'; Code: class Gallery extends CI_Controller {
|
Welcome Guest, Not a member yet? Register Sign In |