Welcome Guest, Not a member yet? Register   Sign In
how to make arrays global?
#1

[eluser]ajsie[/eluser]
i wonder how you can make an array global to all controllers?

so that you can have one array and use it for all views like:

$this->load->view('header', $header)

regards

ajsie
#2

[eluser]eoinmcg[/eluser]
extend the Controller class:
http://ellislab.com/codeigniter/user-gui...aries.html
Replacing Native Libraries with Your Versions

in MY_Controller
Code:
class MY_Controller extends Controller
{

  var $header = array();

  function __construct()
  {
    parent::__construct();

  }

}
then in your controllers, you can reference /. change it with

Code:
$this->header;
#3

[eluser]ajsie[/eluser]
good solution!




Theme © iAndrew 2016 - Forum software by © MyBB