Re: OO Theory Question

From: Date: Tue, 17 Aug 2004 19:03:16 +0000
Subject: Re: OO Theory Question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-194075@lists.php.net to get a copy of this message
* Thus wrote Jed R. Brubaker: > Hi all! I could use some perspective on a project that I am currently > working on. > > I am trying to utilize OO to make my PHP easier, but I keep running into > problems that revolve around the stateless nature of the web. > > Consider the following: I have a login class that is instantiated at the top > of every page. It can log you in, check to see if you are logged in, etc. > This class has an assortment of class variables such as userID, userType, > etc. > > It would be great if I could make a reference to $login->userType on any > given page, but I run into errors as the login class gets reinstantiated on > every page. page1: require_once('class.login.php'); $login = new login(); $_SESSION['login'] = $login; page2: require_once('class.login.php'); $login = $_SESSION['login']: echo $login->userType; see http://php.net/oop.serialization Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid!

« previous php.general (#194075) next »