[eluser]stef25[/eluser]
How can I declare a variable in the constructor of a controller so that this variable is available in the dozens of functions in this controller? I'm not interested in passing it through to a view or model.
Code:
//constructor
function __construct()
{
parent::__construct();
$this->load->helper('form');
$this->load->helper('html');
//none of the following work
$global['uid'] = $this->session->userdata('id');
$this->load->vars($global);
[eluser]danmontgomery[/eluser]
$this->uid works. Although, hardly necessary since $this->session->userdata is available as well. If it's not working, you're doing something else wrong.