效果:
代碼:
/**
* 取出所有分類
* @param int $channel 頻道ID
* @return string
* 調(diào)用{dede:global.getalltype function='getalltype()'/}
*/
function getalltype($channel=0,$line=10)
{
$line = empty($line) ? 10 : $line;
global $dsql,$result;
$dsql->SetQuery("SELECT id,typename,typenamedir,typelitpic,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath
FROM `blog_arctype` WHERE reid='$channel' And ishidden<>1 order by sortrank asc limit 0, $line ");
$dsql->Execute($channel);
if($dsql->GetTotalRow($channel)>0)
{
$result .= "<ul>\r\n";
while($row = $dsql->GetArray($channel))
{
$id = $row['id'];
$typename = $row['typename'];
$typelink = GetOneTypeUrlA($row);
$result .= " <li>\r\n";
$result .= " <a href='{$typelink}' target='_blank'>{$typename}</a>\r\n";
getalltype($id,$line);
$result .= " </li>\r\n";
}
$result .= "</ul>\r\n";
}
return $result;
}