dedecms欄目循環時在欄目前加上序號,織夢文章
導讀:織夢文章在制作dede模板中的導航欄的時候,通常會需要用到如下樣式: * a href=# class=dh1/a * a href=# cl…織夢模板網織夢模板網站。
在制作dede模板中的導航欄的時候,通常會需要用到如下樣式:
* <a href="#" class="dh1"></a> * <a href="#" class="dh2"></a> * <a href="#" class="dh3"></a> * <a href="#" class="dh4"></a> * <a href="#" class="dh5"></a>
這樣的序列在標簽{dede:channel}中是無法調用的,所以必須修改標簽,
默認的{dede:channel}調用方法:
1. {dede:channel type=’top’ row=’9′} 2. <a href="[field:typeurl/]" [field:rel/] title="[field:typename/]" 3. class="dh1">[field:typename/]</a> 4. {/dede:channel}
通過修改,改成下面的樣式:
1. {dede:channel type=’top’ row=’9′ line=’2′} 2. <a href="[field:typeurl/]" title=dede模板堂"[field:typename/]" 3. class="dh[field:line/]" 4. [field:rel/]></a> 5. {/dede:channel}
修改步驟如下:
一、修改文件include/taglib/channel.lib.php,把
1. $attlist = "typeid|0,reid|0,row|100,col|1,type|son,currentstyle|,cacheid|";
修改成
1. $attlist = "typeid|0,reid|0,row|100,col|1,type|son,currentstyle|, 2. cacheid|,line|1"; 3. //|后面的1,代表初始值
第二、在第9行附近追加如下代碼:
1. //默認屬性里設置的行數 2. 3. $default_line = $ctag->CAttribute->Items["line"];
第三、把下面代碼
1. $row['sonids'] = $row['rel'] = ”;
修改成
1. $row['sonids'] = $row['rel'] = ”; 2. $row['line'] = $default_line+$i;
最后,特別要注意的是,如果要使用currentstyle樣式,即當前欄目樣式,則必修將剛才的"line"字段,追加到下面代碼后面
1. $linkOkstr = str_replace("~rel~",$row['rel'],$linkOkstr); 2. $linkOkstr = str_replace("~id~",$row['id'],$linkOkstr); 3. $linkOkstr = str_replace("~typelink~",$row['typelink'],$linkOkstr); 4. $linkOkstr = str_replace("~typename~",$row['typename'],$linkOkstr); 5. $linkOkstr = str_replace("~line~",$rodede商城模板w['line'],$linkOkstr);
聲明: 本文由我的SEOUC技術文章主頁發布于:2023-07-22 ,文章dedecms欄目循環時在欄目前加上序號,織夢文章主要講述欄目,序號,織夢網站建設源碼以及服務器配置搭建相關技術文章。轉載請保留鏈接: http://www.bifwcx.com/article/web_33889.html