search
HomeCMS TutorialDEDECMSHow to call the linkage category on the homepage of dedecms 5.6

How to call the linkage category on the homepage of dedecms 5.6

dedecms 5.6 How to call the linkage category on the homepage?

Implementation method:

Step one: Add the following function to channelunit.func.php

//参数说明:第1个参数是从信息表里读取出来的类别ID,第2个参数是联动菜单类别 //这样这个函数就不限于只调用分类信息的信息类别了,还可以用于其它地方 function GetInfoType($tid,$bigt) { global $dsql; $typename = ''; $query = "Select ename From `dede_sys_enum` 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 ------------------------- 复制代码 (V5.3)加到\include\common.func.php文件的 class="quote"> 
//自定义函数接口

above.

Recommended learning: 梦Weavercms

Step 2: Please use class="quote">

{dede:arclist row=14 titlelen=32 noflag='h' addfields='nativeplace' channelid='1'} 
<li>[[field:nativeplace function=GetInfoType(@me,&#39;nativeplace&#39;)/]] <a href="[field:arcurl/]">[field:title/]</a></li> 
{/dede:arclist}

on the front page to debug.

Code explanation:

1.addfields='nativeplace' channelid='1'This is the additional table field called;

①. Why Want to call additional table fields?

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

②. What does the channelid parameter mean?

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

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

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

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

The above is the detailed content of How to call the linkage category on the homepage of dedecms 5.6. For more information, please follow other related articles on the PHP Chinese website!

Statement
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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools