织梦怎么调用顶级栏目以及下面的二级栏目

织梦怎么调用顶级栏目以及下面的二级栏目

织梦怎么调用顶级栏目以及下面的二级栏目?

织梦调用顶级栏目以及下面的二级栏目

推荐学习:织梦cms

有些时候需要调用顶级栏目以及下面的二级栏目,例如再做下拉菜单时。最简单的调用二级栏目的办法:

{dede:channelartlist typeid='top'} 
  • {dede:field name=’typename’/}
  • {/dede:channelartlist}

    有些时候需要做样式时,需要为dede:channelartlist 里的某个标签加上不同的css,例如下面的例子:

    {dede:channelartlist typeid='top'} 
  • {dede:field name=’typename’/}
  • {/dede:channelartlist}

    {dede:global name=’itemindex’/}为在每次调用顶级栏目,自动递增。

    更复杂的调用二级栏目的方式,要用dede:php标签,如下例:

    
    
    • 网站首页
    • {dede:channelartlist typeid=’top’} {dede:php} $thisid = $refObj->Fields[‘id’]; $dsql->SetQuery(“Select * from `dede_arctype` where reid=”.$thisid.” ORDER BY sortrank”); $dsql->Execute(); $i=0; while($arr = $dsql->getArray()){ $i = $i +1; $str = implode(‘,’,$arr); if(!empty($str) && $i==1){  echo ‘

    • @@##@@

      ‘;  } echo ‘

      ‘.$arr[‘typename’].’

      ‘; } if(!empty($str)) echo ‘

      ‘; if(empty($str)){  echo ‘

    • ‘; } {/dede:php} {dede:field name=’typename’/}  
    • {/dede:channelartlist}

    这种方式虽然更复杂,但也更灵活。

    织梦怎么调用顶级栏目以及下面的二级栏目

    © 版权声明
    THE END
    喜欢就支持一下吧
    点赞12 分享