Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to get any column N-level list Link Tree menu by DedeCms

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

How does DedeCms get any column N-level list link tree menu? This problem may be often seen in our daily study or work. I hope you can gain a lot from this question. The following is the reference content that the editor brings to you, let's take a look at it!

How does DedeCms get any column N-level list link tree menu?

DedeCms access to any column N-level list link tree menu, editor tips, the following modification method, applicable to the default table prefix of DedeCMS, if you modify it during installation, please pay attention to the modification.

Recommended study: dream weaving cms

Add the following code at the bottom of the\ include\ channelunit.func.php file:

/ * Tree column supplement, get level 2, san, level 4 column list / function getProductTree ($typeid) {$linkList = ""; $dsql = new DedeSql (false); $dsql- > SetQuery ("select ID,typedir,typename,isdefault from dede_arctype where reID ='$typeid' order by sortrank"); $dsql- > Execute () While ($row=$dsql- > GetObject ()) {$typelink = GetTypeUrl ($row- > id,MfTypedir ($row- > typedir), $row- > isdefault,$row- > defaultname,$row- > ispart,$row- > namerule2,$row- > moresite,$row- > siteurl,$row- > sitepath); $linkList. = "\ n". $row- > typename. "\ n\ n"; $linkList. = getSonClass ($row- > ID);} $dsql- > Close (); return $linkList;} / / get a link to function getSonClass ($parentid) {$linkList = "" $dsql = new DedeSql (false); $dsql- > SetQuery ("Select ID,typedir,typename,isdefault From dede_arctype where reID='$parentid' order by sortrank"); $dsql- > Execute ($parentid); while ($row=$dsql- > GetObject ($parentid)) {$typelink = GetTypeUrl ($row- > id,MfTypedir ($row- > typedir), $row- > isdefault,$row- > defaultname,$row- > ispart,$row- > namerule2,$row- > moresite,$row- > siteurl,$row- > sitepath); $linkList. = ". $row- > typename." $linkList. = getSonClass2 ($row- > ID);} return $linkList;} function getSonClass2 ($parentid) {$linkList = ""; $dsql = new DedeSql (false); $dsql- > SetQuery ("Select ID,typedir,typename,isdefault From dede_arctype where reID='$parentid' order by sortrank"); $dsql- > Execute ($parentid) While ($row=$dsql- > GetObject ($parentid)) {$typelink = GetTypeUrl ($row- > id,MfTypedir ($row- > typedir), $row- > isdefault,$row- > defaultname,$row- > ispart,$row- > namerule2,$row- > moresite,$row- > siteurl,$row- > sitepath); $linkList. = ". $row- > typename."\ n "; $linkList. = getSonClass3 ($row- > ID);} return $linkList;} function getSonClass3 ($parentid) {$linkList ="; $dsql = new DedeSql (false) $dsql- > SetQuery ("Select ID,typedir,typename,isdefault From dede_arctype where reID='$parentid' order by sortrank"); $dsql- > Execute ($parentid); while ($row=$dsql- > GetObject ($parentid)) {$typelink = GetTypeUrl ($row- > id,MfTypedir ($row- > typedir), $row- > isdefault,$row- > defaultname,$row- > ispart,$row- > namerule2,$row- > moresite,$row- > siteurl,$row- > sitepath); $linkList. = ". $row- > typename."\ n ";} return $linkList;} / * Tree supplement * /

2. Use it in the template

{dede:channel function='getProductTree (2)'} {/ dede:channel}

Just call it. Here 2 in getProductTree (2) is the product display column ID. If yours is something else, please modify it accordingly.

Thank you for reading! After reading the above, do you have a general idea of how DedeCms can get the N-level list link tree menu of any column? I hope the content of the article will be helpful to all of you. If you want to know more about the relevant articles, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report