Welcome Guest, Not a member yet? Register   Sign In
Routing or remap
#2

You can setup routes, or you can use a MY_Controller with a _remap function and extend your controller from your MY_Controller.

Create MY_Controller.php in ./application/core

PHP Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class 
MY_Controller extends CI_Controller {
 
 
   public function __construct() {
 
       log_message('debug'"Class MY_Controller Initialized.");
 
 
       parent::__construct();
 
   }
 
 
   public function _remap($method) {
 
       // Check if the method is available
 
       ifmethod_exists($this$method) ) {
 
           $this->{$method}();
 
       } else {
 
           // Method is your arg value for the view method
 
           $this->view($method);
 
       }
 
   }



Now to use this just extend your controllers from MY_Controller instead of CI_Controller

PHP Code:
class Your_Controller extends MY_Controller {


Reply


Messages In This Thread
Routing or remap - by ernestlambert - 09-30-2015, 06:39 AM
RE: Routing or remap - by Martin7483 - 09-30-2015, 07:44 AM
RE: Routing or remap - by ernestlambert - 09-30-2015, 08:33 AM
RE: Routing or remap - by Martin7483 - 09-30-2015, 11:01 AM
RE: Routing or remap - by ngangchill - 09-30-2015, 08:15 PM



Theme © iAndrew 2016 - Forum software by © MyBB