织梦实现有二级栏目时一级栏目的Url输出 javascript:; 只有一级栏目就输出顶级栏目链接
判断是否有子栏目,有就输出 javascript:; ,没有子栏目就直接输出一级栏目的链接
{dede:field name=typeid runphp=yes}global $dsql;$row = $dsql->GetOne("select * from `dede_arctype` where reid='@me' and ishidden<>1 order by sortrank asc limit 0,1");if(is_array($row)) @me = 'javascript:;'; else @me = GetOneTypeUrlA($dsql->GetOne("select * from `dede_arctype` where id='@me' and ishidden<>1"));{/dede:field}
示范代码:
{dede:channelartlist row=7 typeid=top currentstyle=current} <li> <a href="{dede:field name=typeid runphp=yes}global $dsql;$row = $dsql->GetOne("select * from `dede_arctype` where reid='@me' and ishidden<>1 order by sortrank asc limit 0,1");if(is_array($row)) @me = 'javascript:;'; else @me = GetOneTypeUrlA($dsql->GetOne("select * from `dede_arctype` where id='@me' and ishidden<>1"));{/dede:field}"><span>{dede:field.typename/}</span>{dede:channel type='son' row=1 noself='yes'}<i class="touch-arrow-down"></i>{/dede:channel}</a> {dede:channel type='son' row=1 noself='yes'} <ul> {/dede:channel} {dede:channel type='son' noself='yes'} <li><a href="[field:typelink/]"><span>[field:typename/]</span></a></li> {/dede:channel} {dede:channel type='son' row=1 noself='yes'} </ul> {/dede:channel} </li> {/dede:channelartlist}
输出结果:
织梦二次开发QQ群
本站客服QQ号:862782808(点击左边QQ号交流),群号(383578617) 如果您有任何织梦问题,请把问题发到群里,阁主将为您写解决教程!
转载请注明: 织梦模板 » 织梦导航顶级栏目判断有无下级栏目输出不同的url链接