Mailinglisten-Archive |
Hallo Olaf,
> From: "Olaf Krüger" <OKrueger at edscha.com>
>sehe ich das richtig ?
>$this->content ist bereits ein 2-dim-Array und du weist diesem ein weiteres
Array zu ?
>
>Dann musst du
>$this->content['key1']['key2'][catid]['catname']['level'] )= 'trallala';
>
>schreiben.... oder ?
>
Ja, Du siehst das richtig! Und wie erhalte ich key1 und key2?
Ich verwende folgende rekursive Methode:
function buildTree($parcat,$level=0,$maxlevel=0)
{
foreach($this->content[$parcat] AS $key => $data )
{
array_push ($this->output, $this->content[$parcat][$key]);
$this->output[$parcat][$key]['level']=$level;
if ((isset($this->content[$key])) AND (($maxlevel>$level+1) OR
($maxlevel=="0")))
{
$this->buildTree($key,$level+1,$maxlevel);
}
}
}
php::bar PHP Wiki - Listenarchive