第1步:找到并打开织梦后台目录下的dede/stepselect_main.php文件。
第2步:使用/*和*/注释215行至290行代码。
第3步:注释掉,添加如下代码,并保存。
else if($action=='addenum_save') { if(empty($ename) || empty($egroup)) { Showmsg("类别名称或组名称不能为空!","-1"); exit(); } if($issign == 1 || $topvalue == 0) { $enames = explode(',', $ename); foreach($enames as $ename) { $arr = $dsql->GetOne("SELECT * FROM `dede_sys_enum` WHERE egroup='$egroup' AND (evalue MOD 500)=0 ORDER BY disorder DESC "); if(!is_array($arr)) $disorder = $evalue = ($issign==1 ? 1 : 500); else $disorder = $evalue = $arr['disorder'] + ($issign==1 ? 1 : 500); $dsql->ExecuteNoneQuery("INSERT INTO `dede_sys_enum`(`ename`,`evalue`,`egroup`,`disorder`,`issign`) VALUES('$ename','$evalue','$egroup','$disorder','$issign'); "); } WriteEnumsCache($egroup); ShowMsg("成功添加枚举分类!".$dsql->GetError(), $ENV_GOBACK_URL); exit(); } else if ($issign == 3 && $topvalue != 0) { $minid = $topvalue; $maxnum = 500; // 三级子类最多500个 $enames = explode(',', $ename); foreach ($enames as $ename) { $arr = $dsql->GetOne("SELECT * FROM `dede_sys_enum` WHERE egroup='$egroup' AND evalue LIKE '$topvalue.%%%' ORDER BY evalue DESC "); if(!is_array($arr)) { $disorder = $minid; $evalue = $minid.'.001'; } else { $disorder = $minid; preg_match("#([0-9]{1,})\.([0-9]{1,})#", $arr['evalue'], $matchs); $addvalue = $matchs[2] + 1; $addvalue = sprintf("%03d", $addvalue); $evalue = $matchs[1].'.'.$addvalue; } $sql = "INSERT INTO `dede_sys_enum`(`ename`,`evalue`,`egroup`,`disorder`,`issign`) VALUES('$ename','$evalue','$egroup','$disorder','$issign'); "; // echo $sql;exit; $dsql->ExecuteNoneQuery($sql); } // echo $minid; WriteEnumsCache($egroup); ShowMsg("成功添加枚举分类!".$issign, $ENV_GOBACK_URL); exit(); } else { $minid = $topvalue; $maxid = $topvalue + 500; $enames = explode(',', $ename); foreach($enames as $ename) { $arr = $dsql->GetOne("Select * From `dede_sys_enum` where egroup='$egroup' And evalue>$minid And evalue<$maxid order by evalue desc "); if(!is_array($arr)) { $disorder = $evalue = $minid+1; } else { $disorder = $arr['disorder']+1; $evalue = (int)($arr['evalue']+1); } $dsql->ExecuteNoneQuery("Insert into `dede_sys_enum`(`ename`,`evalue`,`egroup`,`disorder`,`issign`) values('$ename','$evalue','$egroup','$disorder','$issign'); "); } WriteEnumsCache($egroup); ShowMsg("成功添加枚举分类!".$issign, $ENV_GOBACK_URL); exit(); } }
第4步:再次打开织梦 dede后台目录/templets/stepselect_main.htm文件,按以下方法修改,并保存。
if($topvalue % 500 != 0) $arr['issign'] = 2;
修改为
if($topvalue % 500 != 0) $arr['issign'] = 3;
if($topvalue % 500 == 0) $arr['issign'] = 2;
织梦二次开发QQ群
本站客服QQ号:862782808(点击左边QQ号交流),群号(383578617) 如果您有任何织梦问题,请把问题发到群里,阁主将为您写解决教程!
转载请注明: 织梦模板 » 织梦联动类别无法添加二级枚举解决方法