织梦导航循环指定栏目出现 rel="nofollow"代码如下
{dede:channel type='top' row='8'} <a rel="nofollow noopener noreferrer" 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" 就是添加,反之就不添加
另外一种,使用方法就是使用织梦自定义函数,写在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'} <arel="nofollow noopener noreferrer" href="[field:typelink/]"[field:idfunction="is_nofollow(@me)"/]>[field:typename/]</a> {/dede:channel}
本文织梦导航循环指定栏目出现 rel="nofollow"的方法到此结束。一旦立下目标,不达目标绝不罢手,方可成功。小编再次感谢大家对我们的支持!