需求

有二级栏目时一级栏目的Url输出 javascript:; 只有一级栏目就输出链接

解答

判断是否有子栏目,有就输出 javascript:; ,没有子栏目就直接输出一级栏目的链接

{dede:field name=typeid runphp=yes}global $dsql;$row = $dsql->GetOne("select * from `58pic_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 `58pic_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 `58pic_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 `58pic_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}

效果

 

免责声明:本站所有文章和图片均来自用户分享和网络网络,文章和图片版权归原作者及原出地方有,仅供学习与参考,请勿用于商业用途,若是损害了您的权力,请联系网站客服处置。

未经允许不得转载! 作者:网站源码,转载或复制请以超链接形式并注明出处x36交易网

原文地址:https://www.x36.cn/post/3234.html发布于:2021-09-22