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

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

sauo2年前 (2022-12-15)电脑知识43

在用到织梦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模板无限多级栏目调用详细教程方法,” 的相关文章

原创(禁止ping命令操作)linux如何停止ping,linux禁ping操作的方法,linux禁ping操作的方法,

免费领取腾讯云服务器! linux中可以通过ssh命令来禁止其它机器来ping自己,下面是配置方法,大家可以参考一下。 linux中禁ping的方法 方法1 临时禁ping,系统重启后失效,已在ubuntu系...

干货分享(php file_get_contents curl)php file_get_contents post,php file_get_contents(): SSL operation failed with code 1. OpenSSL Error message.....,php file_get_contents(): SSL operation failed with code 1. OpenSSL Error message.....,

免费领取腾讯云服务器! 在调试php脚本代码时,发现使用 file_get_contents() 函数请求HTTPS的网址链接时出现了报错,其报错代码如下面所示“file_get_contents(): SSL operation failed with...

全程干货(查看php是否启动)查看php是否支持rar解压,查看php是ts版本还是nts版本的方法,查看php是ts版本还是nts版本的方法,

全程干货(查看php是否启动)查看php是否支持rar解压,查看php是ts版本还是nts版本的方法,查看php是ts版本还是nts版本的方法,

免费领取腾讯云服务器! 今天有用户来询问php的ts版本与php的nts版本的区别是什么,怎么去查看自己安装的php服务是ts版本还是nts版本,下面博文就来详细的说一下。 php ts版本与nts版本的区别 php官方提供...

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

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

不要告诉别人(php求数组交集)php数组取差集,php计算两个数组的交集与差集,php计算两个数组的交集与差集,

免费领取腾讯云服务器! php中计算两个数组之间的交集与差集可以使用 array_intersect() 与 array_diff() 数组处理函数,这两个数组的具体使用方法如下。 php计算两个数组之间的交集 array_...

这都可以(判断是否是ajax请求)php判断请求方式,php判断是否为ajax请求的方法,php判断是否为ajax请求的方法,

免费领取腾讯云服务器! 在后端可以利用php代码来判断前台提交的数据是否通过ajax进行提交的,其方法也非常的简单,只需要判断$_SERVER["HTTP_X_REQUESTED_WITH"] 是否存在,以及判断 $_SERVER["HTTP_X_REQU...

发表评论

访客

看不清,换一张

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