
dede 副栏目代码是什么?
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 副栏目代码是什么的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号