0

I'm trying to use remap function in codeigniter but it doesn't work. I have a method called submit_me and I would transform it in submit-me in the URL. I read I can use _remap function but unfortunately I wasn't able to use it.

public function _remap($method)
{
    if($method == 'submit-me')
    {
        $this->submit_me();
    }
    else 
    {
        $this->index();
    }
}

this is the correct use of it?

eng_mazzy
  • 1,049
  • 4
  • 23
  • 39
  • 1
    Things to check on: do you have any routes set in the routes config file that could be messing with this? Are you using the correct url when trying to call this method? What page do you actually see? The index page? – Catfish Feb 17 '12 at 20:55
  • @Catfish Thanks ... I resolved the issue...your second question was what I didn't in my applicaiton – eng_mazzy Feb 17 '12 at 21:03

1 Answers1

2

_remap() is used for a call a category.

Example :

I’m building a website for a TV production company. A section was needed to showcase their productions. These productions fall into categories: factual, drama, events, kids and co-productions.

the segment of the url after the controller name is automatically passed as the argument

function _remap($method){   

    if($method == 'current' || 
       $method == 'factual' || 
       $method == 'kids' || 
       $method == 'drama' || 
       $method == 'events' || 
       $method == 'co')
    {

I use segment(4) here as I'm using the URI language class, which adds an extra segment before the controller, so usually segment(3) would be OK

        $this->genre($method, $this->uri->segment(4)); 
    }else{
        $this->index();
    }

}

function index(){

    redirect('productions/current');

} 
krutssss
  • 934
  • 1
  • 10
  • 23