织梦导航循环指定栏目出现 rel="nofollow"的方法
类别:建站知识   时间:02-23

织梦导航循环指定栏目出现 rel="nofollow"代码如下

{dede:channel type='top' row='8'}<a href="[field:typelink/]" [field:id runphp=yes]     if(@me == 1){   @me = 'rel="nofollow"';   }else if(@me == 9){    @me = 'rel="nofollow"';   }else if(@me == 5){    @me = 'rel="nofollow"';   }else if(@me == 8){    @me = 'rel="nofollow" ';   }else if(@me == 7){    @me = 'rel="nofollow"';   }else{@me = '';}   [/field:id]  >[field:typename/]</a>{/dede:channel}

代码说明

if(@me == 9){ @me = 'rel="nofollow")

//如果id等于9就会输出rel="nofollow"

// 如果想让指定id输出rel="nofollow" 就是添加,反之就不添加

织梦导航循环指定栏目出现 rel="nofollow"的方法

另外一种,使用方法就是使用织梦自定义函数,写在include/extend.func.php里

function is_nofollow($id){    switch ($id) {      case '1':         $nofollow = 'rel="nofollow"';        break;      case '2':         $nofollow = 'rel="nofollow"';        break;      case '3':         $nofollow = 'rel="nofollow"';        break;      case '4':         $nofollow = 'rel="nofollow"';        break;      default:         $nofollow = '';        break;    }    return $nofollow;}

织梦调用方法如下

{dede:channeltype='top'row='8'}<ahref="[field:typelink/]"[field:idfunction="is_nofollow(@me)"/]>[field:typename/]</a>{/dede:channel}

智慧半岛,是一家专注于青岛网站建设青岛网站开发的青岛网络公司,Copyright ©2007-2019 Ebandao.Cn 版权所有 All Rights Reserved.(建议在1366x768以上的浏览器中访问)鲁ICP备08014496号

13153297890