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

What is the DEDE sub-column code?

藏色散人
Release: 2019-12-07 10:30:48
Original
2017 people have browsed it

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!

Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template