<?php if(!defined('DEDEINC')) exit('Request Error!'); function lib_randomartlist(&$ctag, &$refObj) { global $dsql; //屬性處理 //topid 指定頂級(jí)樹(shù) id ,指定后,前一個(gè)屬性將無(wú)效 $attlist="typeid|0,showall|,currentstyle|,cacheid|"; FillAttsDefault($ctag->CAttribute->Items,$attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $revalue = ''; //讀取固定的緩存塊 $cacheid = trim($cacheid); if($cacheid !='') { $revalue = GetCacheBlock($cacheid); if($revalue != '') return $revalue; } |
if(empty($typeid)) { if( isset($refObj->TypeLink->TypeInfos['id']) ) { $typeid = $refObj->TypeLink->TypeInfos['id']; $reid = $refObj->TypeLink->TypeInfos['reid']; $topid = $refObj->TypeLink->TypeInfos['topid']; } else { $typeid = 0; } } else { $row2 = $dsql->GetOne("SELECT reid,topid,channeltype,ispart FROM `dede_arctype` WHERE reid='$topid' "); if(!is_array($row2)) { $typeid = $reid = $topid = $channeltype = $ispart = 0; } else { $reid = $row2['reid']; $channeltype = $row2['channeltype']; $ispart = $row2['ispart']; $typepid = $row2['id']; } } //調(diào)用Typeid if( !empty($topid) ) { $topQuery = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath FROM `dede_arctype` WHERE reid='$topid' And ishidden<>1 order by sortrank asc"; } $dsql->Execute('t', $topQuery); while($row = $dsql->GetArray('t')) { $row['typelink'] = GetOneTypeUrlA($row); //處理同級(jí)欄目中,當(dāng)前欄目的樣式 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); $revalue .= $linkOkstr; } else { $revalue .= " <li><a href='{$row['typelink']}'>{$row['typename']}</a></li>n"; } randomartlistSon($row['id'],$typeid,$currentstyle, $revalue); } if($cacheid !='') { WriteCacheBlock($cacheid, $revalue); } return $revalue; } function randomartlistSon($id,$typeid,$currentstyle,&$revalue) { global $dsql; $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); //處理同級(jí)欄目中,當(dāng)前欄目的樣式 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"; } 2、調(diào)用方式: <div class="alist"> <ul> {dede:randomartlist topid='12' current} <li><a href="{dede:field name='typeurl'/}" title="{dede:field name='typename'/}">{dede:field name='typename'/}</a></li> {/dede:randomartlist} </ul> </div> 3、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{} |
版權(quán)聲明: 本站資源均來(lái)自互聯(lián)網(wǎng)或會(huì)員發(fā)布,如果侵犯了您的權(quán)益請(qǐng)與我們聯(lián)系,我們將在24小時(shí)內(nèi)刪除!謝謝!
轉(zhuǎn)載請(qǐng)注明: 織夢(mèng)模板下載dedecms5.7 無(wú)限級(jí)多級(jí)欄目菜單調(diào)用教程