Hello,
i have little trouble with variables in a class. I create servereal objects with one class and fill the variables. When I later try to read the content of some of those vars. they are empty (Children and intChildren). Here ist the PHP-Source:
<?
class cFolder{
var $Content;
var $Count;
var $Description;
var $Link;
var $Children;
var $Parent;
var $intChildren;
var $myName;
function cFolder($strContent, $lngCount, $strDescription, $strLink, $myint) {
$this->Content = $strContent;
$this->Count = $lngCount;
$this->Description = $strDescription;
$this->Link = $strLink;
$this->myName = $myint;
}
function AddChild($objChild) {
$this->Children[count($this->Children)] = $objChild;
$this->intChildren = count($this->Children);
}
function Initialize($lngLevel, $blnLastNode, $strLeftSide) {
if ( $lngLevel > 0 ) { /* ETwas HTML-Code */ }
if ($this->intChildren > 0 ) {
ror ($i = 0; $i < $this->intChildren; $i++) {
$tmp = &$this->Children[$i];
$tmp->Initialize(($lngLevel + 1), ($this->intChildren-1), $strLeftSide);
}
}
}
}
function GetFolder($strContent, $lngCount, $strDescription, $strLink, $myint) {
$tmp = New cFolder($strContent, $lngCount, $strDescription, $strLink, $myint);
return $tmp;
}
function InsFolder(&$objParent, &$objChild) {
$objChild->Parent = $objParent;
$objParent->AddChild($objChild);
return $objChild;
}
$objFolder[0] = GetFolder(Null, Null, Null, Null, 0);
$objFolder[1] = InsFolder($objFolder[1-1], GetFolder("Eins", 1, "Eins", "Eins", 1));
$objFolder[2] = InsFolder($objFolder[2-1], GetFolder("Zwei", 2, "Zwei", "Zwei", 2));
$objFolder[2] = InsFolder($objFolder[2-1], GetFolder("Drei", 3, "Drei", "Drei", 3));
$objFolder[0]->Initialize(0, 1, "");
?>
Has anybogy an idea?
Thank you very much for your Help.
Salomo