i din get waht u want to say .. my bad, but can u explain it with example, plese
thanks :)
Hi,
No need for an apology - my explanation was at best fuzzy. Here's an example of a class within a class:
Main php page (not class definition)
[php]
<?php
require_once($_SERVER['DOCUMENT_ROOT'].'/lib/dataobjects.php');require_once($_SERVER['DOCUMENT_ROOT'].'/lib/userobject.php');
$loDB = new dataObject("DB", "user", "password", "host");
$loUser = new userObject($loDB);
?>
[/php]
So in this code I have created an instance of the dataObject and called it $loDB. I then create an instance of the userObject - $loUser. The userObject needs to have access to the functions on the dataObject. So I pass $loDB as a parameter to the userObject.
Here is the userObject (simplified)
[php]
<?php
class userObject
{
var $loDataObject ;
var $lnUserID ;
var $lnProfileID ;
var $lnOwnerType ;
var $lnLoginCount ;
public function userObject($poDB)
{
$this->loDataObject = $poDB ;
}
?>
[/php]
This then sets the property loDatObject on userObject to be the $loDB as definied in the inital php page. So within the functions on userObject you can say $this->$loDataObject->datafunction(). This then calls the functions on the dataobject from within the userObject.
I hope that explanation makes things a bit clearer. If not give me ashout and I'll try again.
Cheers
nathj