• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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!


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.