noself='yes'织梦无子栏目时不调用顶级栏目的解决方法

使用织梦cms做网站的时候出现的一个问题。使用channel标签调用子栏目时,若该顶级栏目无子栏目,则直接调用了顶级栏目。
想要的效果是有子栏目时就调用子栏目,如果没有子栏目,就不做调用。

想要实现这个方案,需要用到 noself='yes'

将方法记录如下:
1.打开include/taglib/channel.lib.php 文件;
2.在217行左右,找到如下代码:

if($type=='son' && $reid!=0 && $totalRow==0 )
修改为
if($type=='son' && $reid!=0 && $totalRow==0  && $noself==’’)
3.在channel标签中使用 noself='yes'
{dede:channel type='son' noself='yes'}  
   <a href="[field:typelink/]" title="">[field:typename/]</a>  
{/dede:channel}  

4.重新更新html 

猜你喜欢

转载自www.cnblogs.com/secsafe/p/11291951.html