By default Codeigniter class the calls the index function..
if _remap() function is in the present class _remap() function before the index function
The below is the perfect example for the routing and passing the parameter to the index functions.
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Register extends CI_Controller {
public function __construct(){
parent::__construct(); // :: Represent static method of codeigniter system core
$this->load->library('form_validation');
}
function _remap($parameter){
$this->index($parameter);
}
public function index($type){
switch($type){
case 'agent' : echo $type;
break;
case 'service_provider' : echo $type;
break;
case 'channel_partner' : echo $type;
break;
case 'user' : echo $type;
break;
default : die("Some error occured..");
}
}
}
if _remap() function is in the present class _remap() function before the index function
The below is the perfect example for the routing and passing the parameter to the index functions.
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Register extends CI_Controller {
public function __construct(){
parent::__construct(); // :: Represent static method of codeigniter system core
$this->load->library('form_validation');
}
function _remap($parameter){
$this->index($parameter);
}
public function index($type){
switch($type){
case 'agent' : echo $type;
break;
case 'service_provider' : echo $type;
break;
case 'channel_partner' : echo $type;
break;
case 'user' : echo $type;
break;
default : die("Some error occured..");
}
}
}
0 comments:
Post a Comment