Welcome Guest, Not a member yet? Register   Sign In
Simple routing problem
#1

[eluser]Aidy[/eluser]
I have followed the use guide examples and have set up a route

Code:
$route['Food-Safety/Level-2-Award-in-Food-Safety-in-Catering-CIEH'] = "courses/course/30/300";

The route seems to be loading loading the controller but without the last 2 segments eg courses/course.

The controller works fine for www.somedomain.com/courses/course/30/300 here is my controller code.

Code:
function course()
    {
        //category id
        $cat_id = (int) $this->uri->segment(3);
        
        //course id
        $co_id = (int) $this->uri->segment(4);
            
        $data['nav_list'] = $this->coursenav->course_list($cat_id, $co_id);
        
        $data['course'] = $this->model_courses->get_course_info($co_id);        
        $data['dates'] = $this->model_courses->get_course_dates($co_id);
        
        $this->load->view('course', $data);
    }

Any help appreciated?
#2

[eluser]BrianDHall[/eluser]
Try this:

Code:
function course($cat_id = null, $co_id = null )

Then get rid of accessing by segment.

Otherwise you need to check out rsegment() as you are using routing to change the uri segments:

http://ellislab.com/codeigniter/user-gui...s/uri.html
#3

[eluser]Aidy[/eluser]
Hey Brian

Thats Great, thanks alot.

I should have checked that section of the user guide.




Theme © iAndrew 2016 - Forum software by © MyBB