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

The home page of dedecms 5.6calls the method of linkage category.

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Editor to share with you the method of calling linkage categories on the home page of dedecms 5.6. I hope you will gain a lot after reading this article. Let's discuss it together.

How do I call the linkage category on the home page of dedecms 5.6?

Implementation method:

Step 1: add the following function to channelunit.func.php

/ / Parameter description: the first parameter is the category ID read from the information table, and the second parameter is the linkage menu category / / so that this function is not limited to calling the category of classified information, but can also be used in other places function GetInfoType ($tid,$bigt) {global $dsql; $typename =''; $query = "Select ename From `dede_sys_ class` where evalue=$tid and egroup='$bigt'"; $dsql- > Execute ('ename',$query) While ($row = $dsql- > GetArray ('ename')) {$typename. = ($typename==''? $row [' ename']:','. $row ['ename']);} return $typename } / /-Add By CxChina.Com-End-copy code (v5.3) is added to the class= "quote" > / / custom function interface of the\ include\ common.func.php file

Up there.

Recommended study: dream weaving cms

Step 2: please use class= "quote" > on the front page.

{dede:arclist row=14 titlelen=32 noflag='h' addfields='nativeplace' channelid='1'} [[field:nativeplace function=GetInfoType (@ me,'nativeplace') /]] [field:title/] {/ dede:arclist}

To debug.

Code interpretation:

1. Addfieldsoriginating nativeplace` channelid='1' this is the additional table field called

1. Why call additional table fields?

Because the value of the linkage menu is stored in the additional table, you think carefully whether you have ever added a custom linkage menu field!

two。 What does the channelid parameter mean?

Tell the parsing function which table your additional table is in! What is told here is the ID of the additional table, then the additional table corresponding to the ID in the content model you believe the program will automatically find for you.

2. [field:nativeplace /] this is the enumerated value of the called document linkage menu. The additional table stores only the values of the corresponding enumerated values in the associated category.

3. Function=GetInfoType this is our above custom function call! This cannot be changed.

4. (@ me,'nativeplace') there are two variables, the first is @ me, which means the current value, which is fixed, to put it bluntly, it tells us the value of the enumerated value to be queried by the above custom function. The second is the cache group name of the linkage menu, which is generally consistent with the red nativeplace field name in the previous [field:nativeplace/].

After reading this article, I believe you have a certain understanding of the method of calling linkage categories on the home page of dedecms 5.6. if you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!

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