在织梦include/extend.func.php这个文件后面添加如下代码:
/** * 取出所有分类 * @param int $channel 频道ID * @return string * 调用{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; }在需要的位置用{dede:global.getalltype function='getalltype()'/}这个标签来调用