This class can print out an array of threads in threaded or flat mode (any mode you want really) This can be usefull for discussion boards where you want both options
Download
View Source (print view)
Rating : 4.7
Views : 517
<?
class Thread
{ var $beginLevel = "<ul>";
var $endLevel = "</ul>";
var $beginItem = "<li>";
var $endItem = "</li>";
var $wholeThread;
function Thread($code="")
{ if(!empty($code))
{ $this->beginLevel = $code[beginLevel];
$this->endLevel = $code[endLevel];
$this->beginItem = $code[beginItem];
$this->endItem = $code[endItem];
}
}
function sortChilds($threads)
{ while(list($var, $value) = each($threads))
$childs[$value[parent]][$value[ID]] = $value;
return $childs;
}
function convertToThread($threads, $thread)
{ $this->wholeThread .= $this->beginLevel;
while(list($parent, $value) = each($thread))
{ $this->wholeThread .= $this->beginItem . $value[content] . $this->endItem;
if($threads[$parent] && !$value[closed])
$this->convertToThread($threads, $threads[$parent]);
}
$this->wholeThread .= $this->endLevel;
return $this->wholeThread;
}
}
?>
download, regirstration form, php_snips, fedex, call php', userstatusinonline, php_script"_class="neww"_target="_blank"_title="im_neuen, best ide, php script" class="neww" target="_b..., forum, p t test paired, guest, php_tools, href php function, utfraw, php jobs, php script and char(124) (select cast(count(1) as varchar(8000)) char(124) from [sysobjects] where 1=1)>0 and =, commit, gonzo_florin, yahoo status check, rss