Page 1 of 1

How may I use the same object in more than 1 script?

Posted: Tue Dec 17, 2002 5:28 am
by Xpucto
Hi!
How may I maintain an object in more than one script? As soon as I want to use an object in more than one script, I have this problem that I don“t know how to transmit this object to other scripts.

Thanks

Passing Instances?

Posted: Tue Dec 17, 2002 8:27 am
by EricS
Are you asking if you can pass instances of objects from one page to another?

Posted: Tue Dec 17, 2002 9:27 am
by BDKR
When you say "object" are you speaking of an already instantiated entity? Remember, there is a subtle difference between class and object. A class becomes an object when it is instantiated.

That said, it's no problem to include and use the same class in each of your scripts by just including the code for it with a include() or require() function or construct. On the other hand, if what you want is some free running object that each of your scripts can interface with when they're run, you need to take a look at something like SRM or create a php sandbox of some sort.

Cheers,
BDKR

Posted: Tue Dec 17, 2002 10:37 am
by Takuma
If you want to store data like username and password etc. You will probably be best with using a database or a file to store it.