EllisLab text mark
Advanced Search
     
How can I set variables for an entire constructor?
Posted: 31 August 2007 04:20 PM   [ Ignore ]
Avatar
Joined: 2007-08-31
4 posts

Hi!

I have a post constructor which handles all posts to the database. There are three arrays that I want to be able to access in all the different functions of the constructor.

Set these in the class class constructor doesn’t let me access them from the functions using just their name. If there is a way, I don’t know it.

Thanks,

Nicholas

 
Posted: 31 August 2007 08:10 PM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Joined: 2006-06-17
151 posts

Assign the values to variables with class scope

class Category extends Controller {

var $var1;

function 
one() {
  $this
->var1 'one';
}

function two() {
  $this
->var1 'two';
}

 Signature 

CodeCrafter - Open Source Code Generation for CI

 
Posted: 31 August 2007 08:22 PM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Avatar
Joined: 2007-08-31
4 posts

Thank you very much!

Problem solved.