All hail!
I've been trying to create an object-oriented Forum using PHP. My basic logic is that a forum is an object which contains objects for users, messages and such elements.
My problem is that I can't seem to us the methods to those objects within the forum object.
For exemple, there is a member variable named $user in the forum class. $user is set to represent the currently logged in user. I set this variable to a new User object in the constructor.
The problem is when I try to access $user's method later on, using $this->user->method(), I get an error (depending on the context, the error differs, for exemple if used in an if() statement the parser expects a closing parenthesis after $this->user)
I have tried using
$user = $this->user;
$user->method();
and
$user &= $this->user;
$user->method();
but neither work (and I really don't understand why). I'm thinking maybe it would work using call_user_func(), but I'm not quite sure how I should proceed.
(Oh, yeah, I'm using PHP 4.2)