Posted by Bonge Boo! on 05/26/05 02:22
I hope this is an obvious question, but I'm very new to classes.
I have created a class that have a number of variables defined for it.
class cart {
var $username = "blah";
var $password = "blahblah";
var $database = "zippy";
var $hostname = "127.0.0.1";
Etc...
It suddenly struck me that it would make more sense to have these variables
stored in another php include so that other functions and scripts can use
these values without them being duplciated.
However I cannot find out how to pull my "global" variables into my class.
I believe I could make the values constants with
Define('USERNAME' , 'blah');
And simply use that a constant my class. But that also means going through a
whole load of code and changing my $username to USERNAME and probably
buggering something up there.
So if anyone can point the way to getting variables into a class from
"outside" I would appreciate it.
[Back to original message]
|