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 method of calling multi-level column and content list in DedeCMS cycle

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

Share

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

This article mainly introduces the method of calling multi-level columns and content list in DedeCMS cycle, which has a certain reference value and can be used for reference by friends who need it. I hope you will learn a lot after reading this article. Next, let the editor take you to learn about it.

How does DedeCMS cycle through multi-level columns and content lists?

DedeCMS loop calls multi-level columns and content list

Dedecms is still quite good, of course, except for the technical response speed of the forum! Today to share a more practical on the circular call sub-column and its content list of small code, in fact, you can also see the label manual, but after all, there are lazy people!

According to the label manual, in the DedeCMS system, you can use channelartlist tags to loop sub-columns and their column data. It is said that it is also the only call tag in the DedeCMS system that supports tag nesting. The basic usage is as follows, which can be modified as needed:

{dede:channelartlist} {dede:field name='typename'/} more... {dede:arclist titlelen='60' row='8'} [field:pubdate function= "MyDate ('MMMI dongzhongjianmei)' /] [field:title /] {/ dede:arclist} {/ dede:channelartlist}

The above code can realize the call of sub-column and sub-column content list on the home page! Let's talk about the use of channelartlist tags on list pages and content pages.

1. Brief introduction of parameters

The channelartlist tag temporarily supports three parameters, which are:

Typeid='0' restricts the superior column ID; can also use top, support "," means multiple columns

The number of columns in the row='20' loop. Default is 20.

Cacheid =''tag cache ID, usually empty

But if you just copy and paste the above code intact to the ultimate column page or content page, there will not be any call results, because in the tag channelartlist, when typeid is empty, it means the current column, but the ultimate column list and content page do not have subordinate columns, so there will be errors!

2. Call the instance

On the ultimate list page or content page, the correct calling method should be as follows:

{dede:channelartlist typeid='top'}

Here is the top value of typied='top', can be changed to the ID of the parent column you want, but it must not be empty. We must pay attention to this!

3. Highlight the column and call special effects

Under this tag, you can directly use {dede:field name='typename'/} and {dede:field name='typeurl'/} to indicate the column name and column link, and of course there are some other special variables, such as:

Both {dede:field name='id'/} and {dede:field name='typeid'/} denote the column ID; {dede:global name='itemindex'} in the loop, starting with 1; {dede:global name='itemparity'} indicates the loop magic variable, with odd number 1 and even number 2

The above can be directly applied in the channelartlist, especially the second and third, with these two variables, you can easily create a variety of very personalized effects, such as the interlaced discoloration of the column.

The highlight of this column is not included in channelartlist.lib.php, but the current column can be highlighted through the following DIY. Methods (take dedecms 5.6as an example):

Open the channelartlist.lib.php file and find the following code:

$pv- > Fields ['typeurl'] = GetOneTypeUrlA ($typeids [$I])

Add the following code to its next line:

If ($typeids [$I] ['id'] = = $refObj- > TypeLink- > TypeInfos [' id']) {$pv- > Fields ['currentstyle'] =' id= "pic_focus';} else {$pv- > Fields ['currentstyle'] ='' } Thank you for reading this article carefully. I hope the editor will be helpful to everyone by sharing the method of DedeCMS cycle calling multi-level columns and content lists. At the same time, I also hope that you will support more, pay attention to the industry information channels, and find out if you encounter problems. Detailed solutions are waiting for you to learn!

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