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='typeurl'/}">{dede:field name='typename'/}</a></strong> <span><a href="{dede:field name='typeurl'/}">更多...</a></span></dt> <dd> <ul> {dede:arclist titlelen='60' row='8'} <li><span>[field:pubdate function="MyDate('m-d',@me)'/]</span><a href="[field:arcurl /]"> [field:title /]</a></li> {/dede:arclist} </ul> </dd> </dl> {/dede:channelartlist} </div>
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='id'/}与{dede:field name='typeid'/} 均表示循环中的栏目ID; {dede:global name='itemindex'} 表示循环递增变量,从1开始; {dede:global name='itemparity'} 表示循环魔法变量,单数为1,双数为2;
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['typeurl'] = GetOneTypeUrlA($typeids[$i]);
Add the following code to the next line:
if($typeids[$i]['id'] == $refObj->TypeLink->TypeInfos['id']){ $pv->Fields['currentstyle'] = ' id="pic_focus"'; } else{ $pv->Fields['currentstyle'] = ''; }
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!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











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

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 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.

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)

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.

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.

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.

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.
