Hi,
This is not working because the controller is reinitialized on the second call.
For this to work you need to use something to keep the value of $global like session or a variable in your view.
Or returning index in your setGlobal should work.
PHP Code:
class A_Controller extends CI_Controller {
var $global = 0;
public function __construct(){
parent::__construct();
}
public function setGlobal($value){
$this->global = $value;
$this->index();
}
public function index(){
echo $this->global;
}
}
A good decision is based on knowledge and not on numbers. - Plato