Thursday, November 20, 2008

The Recrusive downline Code

Recently developing a affiliate programe and this code will help us to list out the downline user list from database..

From the code, it start looping few time function to list down the downline into an array and then from that array, we can extract out the listing accordingly.

function recrusive_downline($directory, $downnumber=2)
{
$list = vertline($directory);
$deep = $downnumber-1;
while(list($index, $file) = each($list))
{
if($downnumber > "0")
{

if(count(vertline($file))<>0)
{
if($deep >0)
{
$directory_tree[] = array(
'deep' => $downnumber,
'path' => $file,
'content' => recrusive_downline($file, $deep)
);
}else{
$directory_tree[] = array(
'deep' => $downnumber,
'path' => $file
);
}
}else
{
$directory_tree[] = array(
'deep' => $downnumber,
'path' => $file
);
}
}
}
return $directory_tree;
}

0 comments: