主頁 > 網(wǎng)站建設(shè) > 建站知識 > dedecms織夢自定義函數(shù)遞歸拿所有分類(無限分類

dedecms織夢自定義函數(shù)遞歸拿所有分類(無限分類

POST TIME:2017-11-12 23:41

效果:




代碼:

/**
* 取出所有分類
* @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;
}


收縮
  • 微信客服
  • 微信二維碼
  • 電話咨詢

  • 400-1100-266