dede 副栏目增强代码
推荐学习:织梦cms
修改文件/include/taglib/arclist.lib.php第178行
代码如下:
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文件 162行
代码如下:
if($cid != 0) { $wheresql .= ' and arc.typeid in ('.getsonids($cid).')'; }
修改为
代码如下:
if($cid != 0) { $wheresql .= " and (arc.typeid in(".getsonids($cid).") or arc.typeid2 in (".getsonids($cid)."))"; }
在栏目上显示副栏目的名子
一、 \dede\content_list.php 修改代码
//原来的是:$query = "select arc.id,arc.typeid,arc.senddate,arc.flag,arc.ismake,
修改为:$query = "select arc.id,arc.typeid,arc.typeid2,arc.senddate,arc.flag,arc.ismake,
二、\dede\templets\content_list.html
查找:{dede:field.flag function='iscommendarchives(@me)'/}
下面增加:{dede:field.typeid2 function="typeid2archives(@me)"/}
三、 \dede\inc\inc_list_functions.php
增加代码:
注意 5.3是以下代码
//判断副栏目是否有选择 “0” 没选择
代码如下:
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是以下代码
//判断副栏目是否有选择 “0” 没选择
代码如下:
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 ""; } }
以上就是dede 副栏目代码是什么的详细内容。