需求
有二级栏目时一级栏目的Url输出javascript:;只有一级栏目就输出链接
解答
判断是否有子栏目,有就输出javascript:;,没有子栏目就直接输出一级栏目的链接
{dede:field name=typeid runphp=yes}global $dsql;$row = $dsq7 1 x \ ( /l->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("selectL 7 ~ z g , ; C *& k \ _ 4 from `58pic_arctype` where id='@me' an\ T N 0 _ kd ishidden<>1"));{/dede:field}
织梦二次开发示范
{d& f @ ? K o \ tede:channelartlist rowu m 0 x=7 tyH u w / qpeid=top currentstyle=current} <li> <a href="hB d } ^ / b ottp://www.dede58.com/a/dedejq/{dede:field name=typeid runphp=yes}global $dsql;$row = $dsql->GetOne("select * from `58pic_arctype` where r} N f : A 8 k V Heid='@me' and ishidden<>1 order by sortrank asc limit 0,1");if(is_array($row))a a K / z e # @me = 'javascript:;'; else @me = GetOneTypeUrlA($dsql->GetOne("select * from `58pic_arctype` where id='@me' and ishidden<>1")% b /);{/dede:field}"><span>{dede:? j A z 7 w Lfield.typename/}</sp8 / I ^ 2 { g v Yan>{dede:channel type='son' r3 Y M ! O 1ow=1 noselp j $ ; Bf='yes'}<i class=c O g"toH | 0uch-arrow-down"></i>{/dedO + ` V G :e:channel}</a> - $ #; {dede:chR K Y aannel type='son' roG ~ @ C U N t 4 Jw=1 noself=Z r B E W ~ { T X'yes'} <ul> {/dede:channel} {dede:channel type='son' noself='yes'} <li>~ 9 & h l w;<a href="http://www.dede58.com/a/dedejq/[field:typelink/]" rel="external nofollow" ><span>[field:typename/]</span></a></li> {/dede:channel} {dede:y n /channel type='son' row=1 nos\ s T 0 % D L @ oelf='yes'} </ul> {/dede:channel} </li> {/dede:channelartlist}
结果
(此图片来源于网络,$ U 7 m @ v \ m |如有侵权,请联系删除! )