Re: Getting parameters in sub-classes

From: Date: Mon, 13 Nov 2000 09:54:43 +0000
Subject: Re: Getting parameters in sub-classes
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-24938@lists.php.net to get a copy of this message
Did you initialized an object instance of OtherClass? How you intend to use it if it isn't initialized? $otherObject = new OtherClass and in the OtherClass definition, in the function that make use of the $par, global() it for example: class OtherClass extends SuperClass { ......... function get_par() { global $par; return $par; } ........ } So, you can use the $par value then by calling $this->get_par() within a class definition, or $otherObject->get_par() from outside the class. Though, the latter won't have much sence in this case. Ulrich Hacke wrote: > Hello, > I have the following structure: > > class SuperClass > { > .. > } > class OtherClass extends SuperClass > { > .. > } > > In my PHP-document I am constructing an object $myObject = new SuperClass > There is also a parameter in my URL like index.php3?par=somevalue > > How can I read this parameter in my OtherClass? > When I try $par it is always emtpy. What do I do wrong? > > Thanks for any help, > Uli -- Best regards, Max A. Derkachev mailto:kot@books.ru Symbol-Plus Publishing Ltd. phone: +7 (812) 265-0054, 265-1228, phone/fax: 567-8775 http://www.Books.Ru -- All Books of Russia

« previous php.general (#24938) next »