Welcome Guest, Not a member yet? Register   Sign In
Newbie Q: Setting Global vars in a controller
#1

[eluser]Unknown[/eluser]
I have a number of vars I'm going to be plugging into $data in each section of this controller. Does anyone know of an easy way to set a global variable just for this controller? Thanks in advance.

Here's the goods:

Code:
<?php

class Gigiem extends Controller {
  
  function index()  {
    $this->load->model('blog_model');
    $this->load->model('work_model');
    $this->load->helper('text');
    
    $data = array(
      'view' => 'html5',
      'css' => array('html5'),
      'js' => array('site'),
      'static' => 'http://www.mysite.com/static/',
      'title' => 'Welcome!',
      'posts' => $this->blog_model->getRecent(2),
      'projects' => $this->work_model->getRecent(2)
    );
  
    $this->load->view('slate', $data);
  }
  
  function work()  {
    $this->load->model('work_model');
  
    $data = array(
      'view' => 'work',
      'css' => array('html5'),
      'js' => array('site'),
      'static' => 'http://www.mysite.com/static/',
      'title' => 'Previous Work',
      'projects' => $this->work_model->getRecent(2)
    );
    
    $this->load->view('slate', $data);
  }

}


Messages In This Thread
Newbie Q: Setting Global vars in a controller - by El Forum - 05-03-2010, 10:04 AM
Newbie Q: Setting Global vars in a controller - by El Forum - 05-03-2010, 10:38 AM
Newbie Q: Setting Global vars in a controller - by El Forum - 05-03-2010, 10:40 AM
Newbie Q: Setting Global vars in a controller - by El Forum - 05-03-2010, 12:27 PM



Theme © iAndrew 2016 - Forum software by © MyBB