Set a default variable in my controller constructor |
[eluser]sohei[/eluser]
Hi all, I have some variables that appears often in my controller. So I want to define them in my constructor: Code: function __construct() Thanks, sohei
[eluser]cideveloper[/eluser]
Code: function __construct() Read Loader Class - $this->load->vars($array)
[eluser]Dan Bowling[/eluser]
The strategy that I use, which allows inheritance from my base controllers and models is using $this context. For instance, I set info like this: Code: $this->data['foo'] = 'bar'; And when I call a view, it's like this: Code: $this->load->view('my/view', $this->data); |
Welcome Guest, Not a member yet? Register Sign In |