当前位置:首页 > 电脑知识 > 正文内容

干货分享(织梦栏目页模板)cms织梦教程,使用织梦CMS模板无限多级栏目调用详细教程方法,使用织梦CMS模板无限多级栏目调用详细教程方法,

sauo3年前 (2022-12-15)电脑知识160

在用到织梦CMS模板无限级栏目列表菜单时下载了网上的资料都未成功,因此我参考网上及dedecms本身的channel.lib.php及cattree.lib.php制作了调用标签。
在/include/taglib建立一个randomartlist.lib.php文件
内容如下:
<?phpif(!defined(DEDEINC))exit(Request Error!);functionlib_randomartlist(&$ctag,&$refObj){global$dsql;//属性处理//topid 指定顶级树 id ,指定后,前一个属性将无效$attlist="typeid|0,showall|,currentstyle|,cacheid|";FillAttsDefault($ctag->CAttribute->Items,$attlist);extract($ctag->CAttribute->Items,EXTR_SKIP);$revalue=;//读取固定的缓存块$cacheid=trim($cacheid);if($cacheid!=){$revalue=GetCacheBlock($cacheid);if($revalue!=)return$revalue;}//如果属性里没指定栏目id,从引用类里获取栏目信息if(empty($typeid)){if(isset($refObj->TypeLink->TypeInfos[id])){$typeid=$refObj->TypeLink->TypeInfos[id];$reid=$refObj->TypeLink->TypeInfos[reid];$topid=$refObj->TypeLink->TypeInfos[topid];}else{$typeid=0;}}else{$row2=$dsql->GetOne("SELECT reid,topid,channeltype,ispart FROM `dede_arctype` WHERE reid=$topid ");if(!is_array($row2)){$typeid=$reid=$topid=$channeltype=$ispart=0;}else{$reid=$row2[reid];$channeltype=$row2[channeltype];$ispart=$row2[ispart];$typepid=$row2[id];}}//调用Typeidif(!empty($topid)){$topQuery="SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath FROM `dede_arctype` WHERE reid=$topid And ishidden<>1 order by sortrank asc";}$dsql->Execute(t,$topQuery);while($row=$dsql->GetArray(t)){$row[typelink]=GetOneTypeUrlA($row);//处理同级栏目中,当前栏目的样式if($row[id]==$typeid&&$currentstyle!=){$linkOkstr=$currentstyle;$linkOkstr=str_replace("~rel~",$row[rel],$linkOkstr);$linkOkstr=str_replace("~id~",$row[id],$linkOkstr);$linkOkstr=str_replace("~typelink~",$row[typelink],$linkOkstr);$linkOkstr=str_replace("~typename~",$row[typename],$linkOkstr);$revalue.=$linkOkstr;}else{$revalue.=" <li><a href={$row[typelink]}>{$row[typename]}</a></li>n";}randomartlistSon($row[id],$typeid,$currentstyle,$revalue);}if($cacheid!=){WriteCacheBlock($cacheid,$revalue);}return$revalue;}functionrandomartlistSon($id,$typeid,$currentstyle,&$revalue){global$dsql;$query="SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath FROM `dede_arctype` WHERE reid={$id} And ishidden<>1 order by sortrank asc";$dsql->Execute($id,$query);$thisv=;while($row=$dsql->GetArray($id)){$row[typelink]=GetOneTypeUrlA($row);//处理同级栏目中,当前栏目的样式if($row[id]==$typeid&&$currentstyle!=){$linkOkstr=$currentstyle;$linkOkstr=str_replace("~rel~",$row[rel],$linkOkstr);$linkOkstr=str_replace("~id~",$row[id],$linkOkstr);$linkOkstr=str_replace("~typelink~",$row[typelink],$linkOkstr);$linkOkstr=str_replace("~typename~",$row[typename],$linkOkstr);$thisv.=$linkOkstr;}else{$thisv.=" <li><a href={$row[typelink]}>{$row[typename]}</a></li>n";}randomartlistSon($row[id],$typeid,$currentstyle,$thisv);}if($thisv!=)$revalue.=" <ul>n$thisv </ul>n";}

前端调用代码:

<divclass="alist"><ul> {dede:randomartlist topid=12 current} <li><ahref="{dede:field name=typeurl/}"title="{dede:field name=typename/}">{dede:field name=typename/}</a></li> {/dede:randomartlist} </ul></div>

CSS样式:

.alist{}/*第一层修饰*/.alist ul {}.alist ul li {}.alist ul li a{}.alist ul li a:hover,.alist ul li .thisclass{}/*第二层修饰*/.alist ul li ul{}.alist ul li ul li{}.alist ul li ul li a{}.alist ul li ul li a:hover,.alist ul li ul li .thisclass{}
(window.slotbydup = window.slotbydup || []).push({ id: "u6835052", container: "_96bek913mdb", async: true });

本文链接:http://blog.sauo.top/?id=509 感谢分享!

分享到:

扫描二维码推送至手机访问。

版权声明:本文由冬眠先生个人博客发布,如需转载请注明出处。

本文链接:http://blog.sauo.top/?id=509

分享给朋友:

“干货分享(织梦栏目页模板)cms织梦教程,使用织梦CMS模板无限多级栏目调用详细教程方法,使用织梦CMS模板无限多级栏目调用详细教程方法,” 的相关文章

深度揭秘(Ubuntu 防火墙设置)ubuntu防火墙配置文件,ubuntu防火墙的安装与设置,ubuntu防火墙的安装与设置,

免费领取腾讯云服务器! ubuntu系统中的防火墙使用的是iptables,而为了方便防火墙的设置ubuntu提供了一个防火墙管理工具ufw.下面这篇文章就说一说关于防火墙管理工具ufw的安装与使用方法。 ubuntu防火墙ufw的安装与设...

硬核推荐(ubuntu取消自动休眠)ubuntu关闭自动休眠命令,ubuntu 关闭自动休眠模式的方法,ubuntu 关闭自动休眠模式的方法,

硬核推荐(ubuntu取消自动休眠)ubuntu关闭自动休眠命令,ubuntu 关闭自动休眠模式的方法,ubuntu 关闭自动休眠模式的方法,

免费领取腾讯云服务器! 在使用ssh连接ubuntu系统时,发现长时间不输入ssh命令ssh就会自动断开。查找了一下原因,发现是安装ubuntu的电脑自动进入了休眠模式,而ubuntu系统中有多种关闭自动休眠的方法,下面就来说一说使用ssh命令来关闭ubu...

一看就会(imagefilter过滤图像方法)php imagefill,php imagefilter()图片滤镜函数的用法与示例,php imagefilter()图片滤镜函数的用法与示例,

一看就会(imagefilter过滤图像方法)php imagefill,php imagefilter()图片滤镜函数的用法与示例,php imagefilter()图片滤镜函数的用法与示例,

免费领取腾讯云服务器! 有个小需求,需要使用php代码对图片进行颜色调整,比如变成灰色,改变图片的亮度,对比度等等。而php中就内置了一个图片的滤镜函数 imagefilter() ,下面就来具体说说这个函数的用法。 php imagefi...

速看(js将图片转换为二进制流)js将图片转换为webp,js将图片转换为base64编码方法,js将图片转换为base64编码方法,

免费领取腾讯云服务器! js可以将图片文件转成base64编码的,便于图片文件的上传与处理,下面就写几种关于js脚本来转换图片为base64编码的方法。 js将图片转换为base64编码的方法 方法1 将自身...

这都可以?(常用正则表达式大全)常用正则表达式大全图片,常用正则表达式大全,常用正则表达式大全,

免费领取腾讯云服务器! 网上收集了一些常用的正则表达式,基本上都全,需要的可以拿去了。 关于号码的正则表达式 QQ号正则表达式 BASIC /^[1-9][0-9]{...

没想到(js判断域名是否可用)js判断域名是否合法,js判断域名是否为顶级域名的方法,js判断域名是否为顶级域名的方法,

免费领取腾讯云服务器! 写了一个查询域名资料的小项目,需要用户输入查询域名的顶级域名,为了保证用户输入的域名为顶级域名,就写一个通过JS脚本代码来判断输入的域名是否为顶级域名的方法,下面飞鸟慕鱼博客就来分享一下,大家可以做个参考! js判断...

发表评论

访客

看不清,换一张

◎欢迎参与讨论,请在这里发表您的看法和观点。