织梦导航栏目实现三级栏目调用的方法
在用织梦模板做网站的时候,通常有客户要求导航栏目能够下拉显示三级栏目导航菜单,经过研究和网络收集,
用下面的代码可以实现这个功能具体代码如下:
03 |
< li {dede:field name = typeid runphp = "yes" }(@me=="")? @ me = " class='on'" :@ me = "" ;{/dede:field}>< a href = "/" >首页</ a ></ li > |
04 |
{dede:channelartlist typeid='top' row='10' currentstyle="home"} //currentstyle 可以实现栏目切换时改变class状态,但需要修一些文件,具体看下面一段代码 |
05 |
< li class = '{dede:field.currentstyle/}' >< a href = "{dede:field name='typeurl'/}" rel = 'dropmenu' >{dede:field name='typename' /}</ a > |
06 |
< div id = "erji" class = "erji hide" style = "position: absolute;width: 200px" > |
07 |
{dede:sql sql='select * from dede_arctype where reid =~id~ '} |
08 |
< dl style = "position: relative;height: 30px" > |
09 |
< a href = "[field:typedir function='str_replace(" {cmspath}","",@me)'/]" target = '_self' |
10 |
title = "[field:typename/]" style = "width: 90%;padding-left:10%;text-align:left;line-height: 30px" >[field:typename/]</ a > |
11 |
< div id = "sanji" class = "hide" style = "position: absolute;width: 200px;left: 200px;background: #0D6598;" > |
12 |
[field:id runphp='yes'] |
15 |
$sql='Select * from dede_arctype where reid='.$id.' ORDER BY id limit 0,20'; |
16 |
$dsql->SetQuery($sql); |
18 |
while($row = $dsql->GetArray()){ |
19 |
$url = str_replace("{cmspath}","",$row['typedir']); |
20 |
$str .='< a href = "'.$url.'" style = "display: block;width: 90%;padding-left: 10%;text-align: left;line-height: 30px;" >'.$row['typename'].'</ a >'; |
23 |
if(@me == $id){ //避免3级栏目为空时 写出分类ID,这里加以判断 |
32 |
{/dede:channelartlist} |
|
这样就可以实现三级栏目菜单的调用和显示了,后台可以随便修改并且前台也会随时调用。
本文链接:http://www.365ymw.com/article-1366.html 转载请保留出处,谢谢!
中查找“织梦导航栏目实现三级栏目调用的方法”更多相关内容!