DEDE What is the sub-column code?
DEDE sub-column enhancement code
Recommended learning: 梦Weavercms
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.')';
content_list.php file line 162
The code is as follows:
if($cid != 0) { $whereSql .= ' And arc.typeid in ('.GetSonIds($cid).')'; }
Modify to
The code is as follows:
if($cid != 0) { $whereSql .= " And (arc.typeid in(".GetSonIds($cid).") or arc.typeid2 in (".GetSonIds($cid)."))"; }
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='red'>$row->typename</font>]"; } } else { return ""; } }
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='0' and id=$s[$i]"); $dsql->Execute(); while($row = $dsql->GetObject()) { $str.= "[副:<font color='red'>$row->typename</font>]"; } } return $str; } else { return ""; } }
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!