How to realize the Sub-column in DEDE
This article mainly introduces how to achieve the sub-column of DEDE, which is very detailed and has a certain reference value. Friends who are interested must read it!
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 162lines
The code is as follows:
If ($cid! = 0) {$whereSql. = 'And arc.typeid in (' .GetSonds ($cid).')';}
Modify to
The code is as follows:
If ($cid! = 0) {$whereSql. = "And (arc.typeid in (" .GetSonIds ($cid). ") or arc.typeid2 in (" .GetSonIds ($cid). "))";}
Show 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
Modify 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)'/}
The following adds: {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 a choice of "0" no choice
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 (); / / write this alone, $row = $dsql- > GetObject () without while; while ($row = $dsql- > GetObject ()) {return "[pair: $row- > typename]";} else {return ";}}
Dede5.5 is the following code
/ / determine whether the sub-column has a choice of "0" no choice
The code is as follows:
Function Typeid2Archives ($typeid2) {if (sizeof ($typeid2) > 0) {global $dsql; $s=split (",", $typeid2); for ($Select id,ispart,typename From dede_arctype where ispart='0' and id=$s [$I] "); $dsql- > Execute (); while ($row = $dsql- > GetObject ()) {$str.=" [vice: $row- > typename] ";} return $str;} else {return" }} above is how DEDE realizes all the contents of the sub-column. Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!