Posted by Bonge Boo! on 05/26/05 12:06
On 26/5/05 7:53 am, in article Gnele.1486038$8l.366880@pd7tw1no, "Paul"
<freelance@dezignage.net> wrote:
>> So if anyone can point the way to getting variables into a class from
>> "outside" I would appreciate it.
>>
> sorry just a quick note I caught myself on...
>
> inside the object you'd have to declare the variable... like so..
>
> class Cart {
> var $var;
>
> function Cart() {
> $this->var =& $GLOBALS['var'];
> }
>
> }
>
> for php 5 you can use its "native" constructor __Construct() instead of
> the shown example... which is for PHP < 5 :)
Ok. Just found
http://docs.php.net/en/language.oop.html
Which explains the above quite nicely. So it looks like major re-write time.
Dunno if I can be bothered at this stage (which will almost certainly come
back and bit me in the ass)
Thanks for your thoughts.
[Back to original message]
|