zoukankan      html  css  js  c++  java
  • 织梦dedecms 扩展channel栏目标签 获取交叉栏目名称和链接

    channel栏目标签默认有调用顶级栏目(top)、子栏目(son)、同级栏目(self),那想获取交叉栏目的名称和链接怎么获取呢?

    其实在原来的代码上改一下就可以了。下面是具体代码。打开文件channel.lib.php:

    在搜索:

    $topid = $refObj->TypeLink->TypeInfos['topid'];

    在其下方增加:

    $crossid = $refObj->TypeLink->TypeInfos['crossid'];

    再搜索:

    $topid = $row2['topid'];

    在其下方增加:

    $crossid = $row2['crossid'];

    然后再查找:

    1     else if($type=='son')
    2     {
    3         if($typeid==0) return '';
    4         $sql = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath
    5           From `#@__arctype` WHERE reid='$typeid' And ishidden<>1 order by sortrank asc limit 0, $line ";
    6     }

    在下方增加:

    1     else if($type=='cross')
    2     {
    3         if($typeid==0) return '';
    4         $sql = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,crossid
    5           From `#@__arctype` WHERE id in ($crossid) And ishidden<>1 order by sortrank asc limit 0, $line ";
    6     }

    如此修改之后就可以在模板上使用了。

    模板代码为:

    1                         {dede:channel type='cross'}
    2                         <a href='[field:typelink /]' title="[field:typename/]" >[field:typename/]</a> 
    3                         {/dede:channel}
    View Code

    这样就可以使用了。

  • 相关阅读:
    软件工程结对作业
    软件工程第二次作业
    软件工程第一次作业
    MATLAB安装教程
    实现生成小学四则运算练习题
    结对编程-审查代码
    软件第三次作业
    练习使用Eclipse进行单元测试
    软件工程第一次作业
    Visual Studio Code (vscode)
  • 原文地址:https://www.cnblogs.com/cnteam/p/4056830.html
Copyright © 2011-2022 走看看