Home CMS Tutorial DEDECMS What is the DEDE sub-column code?

What is the DEDE sub-column code?

Dec 07, 2019 am 10:30 AM
dede

What is the DEDE sub-column code?

DEDE What is the sub-column code?

DEDE sub-column enhancement code

Recommended learning: 梦Weavercms

What is the DEDE sub-column code?

Modify line 178 of the file /include/taglib/arclist.lib.php

The code is as follows:

if($CrossID=='') 
//$orwheres[] = ' typeid in ('.GetSonIds($typeid).')'; 
$orwheres[] = ' typeid in ('.GetSonIds($typeid).') or typeid2 in ('.GetSonIds($typeid).')'; 
else 
//$orwheres[] = ' typeid in ('.GetSonIds($typeid).','.$CrossID.')'; 
$orwheres[] = ' typeid in ('.GetSonIds($typeid).','.$CrossID.') or typeid2 in ('.GetSonIds($typeid).','.$CrossID.')';
Copy after login

content_list.php file line 162

The code is as follows:

if($cid != 0) 
{ 
$whereSql .= ' And arc.typeid in ('.GetSonIds($cid).')'; 
}
Copy after login

Modify to

The code is as follows:

if($cid != 0) 
{ 
$whereSql .= " And (arc.typeid in(".GetSonIds($cid).") or arc.typeid2 in (".GetSonIds($cid)."))"; 
}
Copy after login

Display the name of the sub-column on the column

1. \dede\content_list.php Modify the code

//The original is: $query = "Select arc.id, arc.typeid, arc.senddate, arc.flag, arc.ismake,

Changed to: $query = "Select arc.id,arc.typeid,arc.typeid2,arc.senddate,arc.flag,arc.ismake,

2.\dede\templets\content_list.html

Find: {dede :field.flag function='IsCommendArchives(@me)'/}

Add below: {dede:field.typeid2 function="Typeid2Archives(@me)"/}

3. \ dede\inc\inc_list_functions.php

Add code:

Note that 5.3 is the following code

//Determine whether the sub-column has "0" selected or not

The code is as follows:

function Typeid2Archives($typeid2) 
{ 
if($typeid2>0) 
{ 
global $tid,$dsql; 
$dsql->SetQuery("Select id,ispart,typename From dede_arctype where ispart='0' and id=$typeid2"); 
$dsql->Execute(); 
//单单写这个,不用while也可以 $row = $dsql->GetObject(); 
while($row = $dsql->GetObject()) 
{ 
return "[副:<font color=&#39;red&#39;>$row->typename</font>]"; 
} 
} 
else 
{ 
return ""; 
} 
}
Copy after login

dede5.5 is the following code

//Judge whether "0" is selected in the sub-column or not

The code is as follows:

function Typeid2Archives($typeid2) 
{ 
if(sizeof($typeid2)>0) 
{ 
global $dsql; 
$s=split(",",$typeid2); 
for($i=0;$i<sizeof($s); $i++) 
{ 
$dsql->SetQuery("Select id,ispart,typename From dede_arctype where ispart=&#39;0&#39; and id=$s[$i]"); 
$dsql->Execute(); 
while($row = $dsql->GetObject()) 
{ 
$str.= "[副:<font color=&#39;red&#39;>$row->typename</font>]"; 
} 
} 
return $str; 
} 
else 
{ 
return ""; 
} 
}
Copy after login

The above is the detailed content of What is the DEDE sub-column code?. 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)