title: codeigniter $this->load->vars between controllers
body: <p>hi found free source code based in codeigniter,</p>
  
  <p>i have a controller in codeigniter some code is this:</p>
  
  <pre><code>    class front extends main
      {
  
          function __construct()
          {
              parent::__construct();
  
              $this-&gt;load_main_vars();
  
          }
  
  
          private function load_main_vars()
          {
              $vars['title'] = $this-&gt;option-&gt;get('title');
              $vars['keywords'] = $this-&gt;option-&gt;get('keywords');
              $vars['description'] = $this-&gt;option-&gt;get('description');
              $this-&gt;db-&gt;order_by('category_name', 'ASC');
              $this-&gt;db-&gt;where('category_active', 1);
              $vars['categories'] = $this-&gt;db-&gt;get_where('categories', array('category_state' =&gt; 1))-&gt;result();
              $this-&gt;load-&gt;vars($vars);
          }
  }
  </code></pre>
  
  <p>then i have another controller that extends front(code above):</p>
  
  <pre><code>    class Site extends front
      {
  
  
          function __construct()
          {
              parent::__construct();
  
          }
  
          function index()
          {
  
              $vars['site'] = $this;
  
              $this-&gt;view('site/index', $vars);
          }
  }
  </code></pre>
  
  <p>my question is why i have to use <code>this $vars['site'] = $this;</code> in Site controller to use vars array added in front controller and pass to view, </p>
  
  <p>thanks</p>