POST TIME:2018-09-02 12:43
在制作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="[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~",$row['line'],$linkOkstr);
好了,以上就是如何给织梦DEDECMS栏目导航{dede:channel}标签增加序号属性,希望对大家有帮助。
