$query = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath FROM `dede_arctype` WHERE reid='{$id}' And ishidden<>1 order by sortrank asc";
$dsql->Execute($id, $query);
$thisv = '';
while($row = $dsql->GetArray($id))
{
$row['typelink'] = GetOneTypeUrlA($row);
//处理同级栏目中,当前栏目的样式
if( $row['id']==$typeid && $currentstyle!='' )
{
$linkOkstr = $currentstyle;
$linkOkstr = str_replace("~rel~",$row['rel'],$linkOkstr);
$linkOkstr = str_replace("~id~",$row['id'],$linkOkstr);
$linkOkstr = str_replace("~typelink~",$row['typelink'],$linkOkstr);
$linkOkstr = str_replace("~typename~",$row['typename'],$linkOkstr);
$thisv .= $linkOkstr;
}
else
{
$thisv .= " <li><a href='{$row['typelink']}'>{$row['typename']}</a></li>n";
}
randomartlistSon($row['id'],$typeid,$currentstyle, $thisv);
}
if($thisv!='') $revalue .= " <ul>n$thisv </ul>n";
}
前端调用
<div class="alist">
<ul>
{dede:randomartlist topid='12' current}
<li><a href=https://www.91084.com/"{dede:field name='typeurl'/}" title=https://www.91084.com/"{dede:field name='typename'/}">{dede:field name='typename'/}</a></li>
{/dede:randomartlist}
</ul>
</div>
css样式
.alist{}
/*第一层修饰*/
.alist ul {}
.alist ul li {}
.alist ul li a{}
.alist ul li a:hover,.alist ul li .thisclass{}
/*第二层修饰*/
.alist ul li ul{}
.alist ul li ul li{}
.alist ul li ul li a{}
.alist ul li ul li a:hover,.alist ul li ul li .thisclass{}