• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[solved]$this->load->vars($array) question

#1
[eluser]quasiperfect[/eluser]
hi

The variables loaded using $this->load->vars($array) are usable inside the controller ?
If so, how ?

I tried like this but no luck inside the view is ok but not in the controller
I'm using the latest reactor from bitbucket
Code:
class Welcome extends MY_Controller {
    function __construct()
    {
        parent::__construct();
        $myvars['b'] = 'test';
        $this->load->vars($myvars);
    }

    function index()
    {
        echo $b;
    }
}

#2
[eluser]WanWizard[/eluser]
No, the result of $this->load->vars() is only used in views.

The example is a bit pointless, if you want something like that, either use $this->b, or $this->myvars['b'] if you want to retain the array.

#3
[eluser]quasiperfect[/eluser]
thanks for responding
i always used $this->b but i wanted to be sure on the purpose of $this->load->vars()


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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