dedecms教程:织梦栏目导航{dede:channel}标签添加序号教程

2016-08-07 717

dedecms教程:织梦栏目导航{dede:channel}标签添加序号教程!我们在用织梦模版建站做栏目导航时,需要用到下面的样式:

<a href="#" rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow" ></a> <a href="#" rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow" ></a> <a href="#" rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow" ></a> <a href="#" rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow" ></a> <a href="#" rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow" ></a>

这样的序列在标签{dede:channel}中是无法调用的,所以必须修改标签,

默认的{dede:channel}调用方法:

{dede:channel type='top' row='8'}     
 
<a href="[field:typeurl/]" rel="external nofollow"  rel="external nofollow"  [field:rel/] title="[field:typename/]">[field:typename/]</a>
 
{/dede:channel}

通过修改,改成下面的样式:

{dede:channel type='top' row='8' line='2'}     
 
<a href="[field:typeurl/]" rel="external nofollow"  rel="external nofollow"  title="[field:typename/]" class="dh[field:line/]" [field:rel/]></a>
 
{/dede:channel}

修改步骤如下:

一、修改文件include/taglib/channel.lib.php,把

DEDE模板

$attlist = "typeid|0,reid|0,row|100,col|1,type|son,currentstyle|,cacheid|";

修改成

$attlist = "typeid|0,reid|0,row|100,col|1,type|son,currentstyle|,cacheid|,line|1";  //|后面的1,代表初始值

第二、在第9行附近追加如下代码:

//默认属性里设置的行数   $default_line = $ctag->CAttribute->Items["line"];

第三、把下面代码

$row['sonids'] = $row['rel'] = '';

修改成

$row['sonids'] = $row['rel'] = '';  $row['line'] = $default_line+$i;

最后,特别要注意的是,如果要使用currentstyle样式,即当前栏目样式,则必修将刚才的”line”字段,追加到下面代码后面

$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);  $linkOkstr = str_replace("~line~",$row['line'],$linkOkstr);

好了,以上就是怎么给织梦dedecms栏目导航{dede:channel}标签添加序号,希望对大家修改织梦dedecms有所帮助。

在DEDECMS中,我们会发现导航代码中有一个[field:rel/],这个标签是导航栏中用来显示下级菜单栏目。

声明: 本站仅提供资源学习下载,资源费用仅为赞助站长的整理费,不代表资源自身价值也不包含任何服务。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。
本站提供的资源来自网络,版权争议与本站无关,所有内容及软件的文章仅限用于学习和研究目的。
如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。侵删请致信E-mail:duhaomu@163.com

浩沐资源网 织梦技巧 dedecms教程:织梦栏目导航{dede:channel}标签添加序号教程 https://www.dhaomu.com/5773.html

相关文章

发表评论
暂无评论
  • 0 +

    访问总数

  • 0 +

    会员总数

  • 0 +

    文章总数

  • 0 +

    今日发布

  • 0 +

    本周发布

  • 0 +

    运行天数

浩沐资源网-打造全网优质免费教程资源分享网站!