Welcome Guest, Not a member yet? Register   Sign In
Codeigniter URL Pattern using htaccess / route / model
#2

Yes, you can have an URL like that. How is up to you.

An option is to use the _remap method

Add this to your controller
PHP Code:
public function _remap($method) {
 
   // $method = typically the second segment of the URI
 
   if ($method === 'some_method') {
 
       $this->$method();
 
   } else {
 
       $this->what_ever_method();
 
   }


What this does is override the default behavior of how CI calls methods. When this method is available within the called controller this is the first method called.
From here you can route to any other method within the called controller.

If you want controllers calling controllers how should look into HMVC
But if you are new to MVC and CI I would advise getting to know the basics first.

Hope this helps you on your way
Reply


Messages In This Thread
RE: Codeigniter URL Pattern using htaccess / route / model - by Martin7483 - 12-14-2015, 04:11 AM



Theme © iAndrew 2016 - Forum software by © MyBB