織夢CMS讓channelartlist標簽支持currentstyle織夢技巧
導讀:織夢技巧織夢技巧currentstyle屬性在DedeCMS調用標簽里主要用于實現欄目頁的高亮設置,也就是支持dede:channel標簽,而很多時候,我們在調用欄目的時候,會網站建設哪家好高端網站建設。
currentstyle屬性在DedeCMS調用標簽里主要用于實現欄目頁的高亮設置,也就是支持dede:channel標簽,而很多時高端網站建設候,我們在調用欄目的時候,會用到dede:channelartlist來調用頂級欄目,這樣currentstyle屬性就不支持了,需要我們做二次發開。 今天就教大家如何實現channelartlist標簽支持currentstyle屬性。 打開 include\taglib\channelartlist.lib.php,找到代碼: $pv-Fields[ typeurl ] […]
currentstyle屬性在DedeCMS調用標簽里主要用于實現欄目頁的高亮設置,也就是支持dede:channel標簽,而很多時候,我們在調用欄目的時候,會用到dede:channelartlist來調用頂級欄目,這樣currentstyle屬性就不支持了,需要我們做二次發開。
今天就教大家如何實現channelartlist標簽支持currentstyle屬性。
打開 include\taglib\channelartlist.lib.php,找到代碼:
$pv->Fields['typeurl'] = GetOneTypeUrlA($ty網站seo優化培訓peids[$i]);在此行代碼下方增加以下代碼:
if($typeids[$i]['id'] == $refObj->TypeLink->TypeInfos['id'] || $typeids[$i]['id'] == $refObj->TypeLink->TypeInfos['topid'] ){ $pv->Fields['currentstyle'] = $currentstyle ? $currentstyle : 'current'; } &n網站seo優化bsp; else{ $pv->Fields['currentstyle'] = ''; }網上找到的一般沒有加 $typeids[$i]['id'] ==$refObj->TypeLink->TypeInfos['topid']
添加這個后才能對二級欄目也起作用,調用方法:
{dede:channelartlist typeid='2' currentstyle='current'} <li class='{dede:field.currentstyle/}'><a href='{dede:field name='typeurl'/}'>{dede:field name='typename'/}</a></li> 。。。 {/dede:channelartlist}如果是當前欄目則 li的class屬性顯示current,否則顯示class='' ,也可以修改currentstyle='這里改為你需要的類名'。
聲明: 本文由我的SEOUC技術文章主頁發布于:2023-05-25 ,文章織夢CMS讓channelartlist標簽支持currentstyle織夢技巧主要講述標簽,標題,CMS網站建設源碼以及服務器配置搭建相關技術文章。轉載請保留鏈接: http://www.bifwcx.com/article/web_7823.html