[eluser]alpineedge3[/eluser]
Hello, I think my question has to do with scope in OO structure.
I have the following controller:
Code:
include("myglobals.php");
class Photo extends Myglobals {
function index()
{
$this->load->model('m_photo','',TRUE); // true connects to db.
$data = array();
$data += $this->globalArray;
$data['heading'] = 'photo';
$data['title'] .= $data['heading'];
$data['subhead'] = 'pictures from my travels';
$data['albums'] = $this->m_photo->getAlbums();
$this->load->view('v_photoalbums',$data);
}
}
I want to add other functions and want the $data vars to be available to them as well. So should I move them to a constructor? Can you give me a short example of how the vars would be defined within the constructor? And then, how do I access the variables within the functions? do I use $this-> syntax? i'm new to class structures.
thanks