dedecms如何使用标签
DEDECMS副栏目代码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)."))";
}
在栏目上显示副栏目的名子
一、
dedecontent_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 empletscontent_list.html
查找:{dede:field.flag function='IsCommendArchives(@me)'/}
下面增加:{dede:field.typeid2 function="Typeid2Archives(@me)"/}
三、
dedeincinc_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 "";
}
}