Home CMS Tutorial DEDECMS How does DedeCMS circularly call multi-level columns and content lists?

How does DedeCMS circularly call multi-level columns and content lists?

Jan 03, 2020 am 09:07 AM
dedecms

How does DedeCMS circularly call multi-level columns and content lists?

How does DedeCMS circularly call multi-level columns and content lists?

DedeCMS loops to call multi-level columns and content lists

Recommended learning: Dreamweavercms

Dedecms is quite good, of course. In addition to the technical reply speed of the forum! ! Today I will share a relatively practical small code for cyclically calling sub-columns and their content lists. In fact, you can also see it by looking at the tag manual, but after all, there are still lazy people!

According to the tag manual, in the DedeCMS system, the channelartlist tag can be used to cycle sub-columns and their column data. It is said that it is also the only one in the DedeCMS system that supports tag nesting. The basic usage of calling tags is as follows, which can be modified as needed:

<div> 
{dede:channelartlist}  
<dl> 
<dt><strong><a href="{dede:field name=&#39;typeurl&#39;/}">{dede:field name=&#39;typename&#39;/}</a></strong>
<span><a href="{dede:field name=&#39;typeurl&#39;/}">更多...</a></span></dt> 
<dd> 
<ul> 
{dede:arclist titlelen=&#39;60&#39; row=&#39;8&#39;}  
<li><span>[field:pubdate function="MyDate(&#39;m-d&#39;,@me)&#39;/]</span><a href="[field:arcurl /]">
[field:title /]</a></li> 
{/dede:arclist}  
</ul> 
</dd> 
</dl> 
{/dede:channelartlist}  
</div>
Copy after login

The above code can realize the calling of sub-columns and sub-column content lists on the home page! Let’s talk about the use of the channelartlist tag on list pages and content pages.

1. Parameter introduction

The channelartlist tag temporarily supports three parameters, which are:

typeid='0' to limit the upper-level column ID; you can also use top, which supports " ," indicates multiple columns

row='20' The number of columns to cycle, the default is 20;

cacheid = '' tag cache ID, usually empty

but If you just copy and paste the above code unchanged to the ultimate column page or content page, no call results will appear, because in the tag channelartlist, when the typeid is empty, it means the current column, but the ultimate column list and The content page has no subordinate columns, so an error will occur!

2. Calling example

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

{dede:channelartlist typeid='top'}

Here is typed='top'. The top value can be replaced by the upper-level column ID you want, but it must not be empty. Everyone must pay attention to this!

3. Column highlighting and special effect calling

Under this label, you can directly use {dede:field name='typename'/} and {dede:field name='typeurl' respectively. /} to represent the column name and column link. Of course, there are some other special variables, which are also introduced here, such as:

{dede:field name=&#39;id&#39;/}与{dede:field name=&#39;typeid&#39;/} 均表示循环中的栏目ID;
{dede:global name=&#39;itemindex&#39;} 表示循环递增变量,从1开始;
{dede:global name=&#39;itemparity&#39;} 表示循环魔法变量,单数为1,双数为2;
Copy after login

The above can be applied directly in channelartlist. Special attention should be paid to the first 2 and 3. With these two variables, you can easily create various very personalized effects, such as changing the color of columns every other row.

Regarding the highlighting of this column, channelartlist.lib.php does not come with it, but through the following DIY, the current column can be highlighted. Method (taking dedecms 5.6 as an example):

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

$pv->Fields[&#39;typeurl&#39;] = GetOneTypeUrlA($typeids[$i]);
Copy after login

Add the following code to the next line:

if($typeids[$i][&#39;id&#39;] == $refObj->TypeLink->TypeInfos[&#39;id&#39;]){  
$pv->Fields[&#39;currentstyle&#39;] = &#39; id="pic_focus"&#39;;  
}  
else{  
$pv->Fields[&#39;currentstyle&#39;] = &#39;&#39;;  
}
Copy after login

Then , you can use {dede:field name='currentstyle'/} to call it in the template.

The above is the detailed content of How does DedeCMS circularly call multi-level columns and content lists?. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1655
14
PHP Tutorial
1254
29
C# Tutorial
1228
24
Where is the imperial cms resource network template? Where is the imperial cms resource network template? Apr 17, 2024 am 10:00 AM

Empire CMS template download location: Official template download: https://www.phome.net/template/ Third-party template website: https://www.dedecms.com/diy/https://www.0978.com.cn /https://www.jiaocheng.com/Installation method: Download template Unzip template Upload template Select template

How dedecms implements template replacement How dedecms implements template replacement Apr 16, 2024 pm 12:12 PM

Template replacement can be implemented in Dedecms through the following steps: modify the global.cfg file and set the required language pack. Modify the taglib.inc.php hook file and add support for language suffix template files. Create a new template file with a language suffix and modify the required content. Clear Dedecms cache.

How to upload local videos to dedecms How to upload local videos to dedecms Apr 16, 2024 pm 12:39 PM

How to upload local videos using Dedecms? Prepare the video file in a format that is supported by Dedecms. Log in to the Dedecms management backend and create a new video category. Upload video files on the video management page, fill in the relevant information and select the video category. To embed a video while editing an article, enter the file name of the uploaded video and adjust its dimensions.

What website can dedecms do? What website can dedecms do? Apr 16, 2024 pm 12:24 PM

Dedecms is an open source CMS that can be used to create various types of websites, including: news websites, blogs, e-commerce websites, forums and community websites, educational websites, portals, other types of websites (such as corporate websites, personal websites, photo album websites, video sharing website)

What loopholes does dedecms have? What loopholes does dedecms have? Aug 03, 2023 pm 03:56 PM

DedeCMS is an open source content management system that has some potential vulnerabilities and security risks: 1. SQL injection vulnerability. Attackers can perform unauthorized operations or obtain sensitive data by constructing malicious SQL query statements; 2. File Upload vulnerability, attackers can upload files containing malicious code to the server to execute arbitrary code or obtain server permissions; 3. Sensitive information leakage; 4. Unauthenticated vulnerability exploitation.

How to use dedecms How to use dedecms Apr 16, 2024 pm 12:15 PM

Dedecms is an open source Chinese CMS system that provides content management, template system and security protection. The specific usage includes the following steps: 1. Install Dedecms. 2. Configure the database. 3. Log in to the management interface. 4. Create content. 5. Set up the template. 6. Manage users. 7. Maintain the system.

How does dedecms implement template replacement? How does dedecms implement template replacement? Apr 16, 2024 pm 12:21 PM

To implement template replacement in DedecMS, you need to perform the following steps: Determine the template file to be replaced. Common files include index.htm, list.htm and show.htm. Create a new template file, retaining the DedecMS markup. Upload the new template file, overwriting the original file. clear cache. Refresh the site to see the changes.

How to change pictures in dedecms How to change pictures in dedecms Apr 16, 2024 pm 12:27 PM

Steps to modify images in DedeCMS: Log in to the DedeCMS backend. Visit the System > Media Management page. Select the image you want to edit. Click the "Edit" button. Modify image titles, descriptions, tags, and copyright information. Crop or resize picture. Click the "Save" button to save changes. Return to the media management page and click the "Update Image Library" button to apply the changes to the site.

See all articles