返回列表 回复 发帖

[DEDECMS]化复杂为简单,在列表页完成-取消推荐.加粗,颜色变化功能

我现在只用DEDE3.01 弄过3.1后台 4.0还没看
此功能哦都是在DEDE3.01下测试的
这样子,采集完数据,直接在列表页搞来搞去就OK了,哈哈
取消推荐功能
如果你的文章推荐了,DEDE版本下只能进入文章管理然后把 推荐 选框去掉-然后再点确定-后台又得找列表.弄过的都晓得这样非常麻烦滴.
方法:
在\DEDE目录下 查找archives_do.php文件
找到这个
  1. //推荐文档
  2. function commendArchives();
  3. ---------------------------*/
  4. else if($dopost=="commendArchives"
  5. {
  6. SetPageRank(5);
  7. if( $aid!="" && !ereg("(".$aid."`|`".$aid."",$qstr) ) $qstr .= "`".$aid;
  8. if($qstr==""{
  9.    ShowMsg("参数无效!",$ENV_GOBACK_URL);
  10.    exit();
  11. }
  12. $qstrs = explode("`",$qstr);
  13. $dsql = new DedeSql(false);
  14. foreach($qstrs as $aid)
  15. {
  16.    $aid = ereg_replace("[^0-9]","",$aid);
  17.    if($aid=="" continue;
  18.    $dsql->SetQuery("Update #@__archives set [color=Red]iscommend='11' [/color]where ID='$aid'";
  19.    $dsql->ExecuteNoneQuery();
  20. }
  21. $dsql->Close();
  22. ShowMsg("成功把所选的文档设为推荐!",$ENV_GOBACK_URL);
  23. exit();
  24. }
  25. /*--------------------------
复制代码
将红字改为iscommend='0'
然后去DEDE后台列表中右键,点"推荐"的时候,实际上是取消推荐

如果你想在列表增加颜色和加粗的,看下面
文件方位 dede\templets\content_list.htm
原代码
  1. //上下文菜单
  2. function ShowMenu(obj,aid,atitle)
  3. {
  4.   var eobj,popupoptions
  5.   popupoptions = [
  6.     new ContextItem("浏览文档",function(){ window.open("archives_do.php?aid="+aid+"&dopost=viewArchives"; }),
  7.     new ContextItem("编辑文档",function(){ location="archives_do.php?aid="+aid+"&dopost=editArchives"; }),
  8.     new ContextSeperator(),
  9.     new ContextItem("更新HTML",function(){ var qstr=getCheckboxItem(); location="archives_do.php?aid="+aid+"&dopost=makeArchives&qstr="+qstr; }),
  10.     new ContextItem("审核文档",function(){ var qstr=getCheckboxItem(); location="archives_do.php?aid="+aid+"&dopost=checkArchives&qstr="+qstr; }),
  11.     new ContextItem("推荐文档",function(){ var qstr=getCheckboxItem(); location="archives_do.php?aid="+aid+"&dopost=commendArchives&qstr="+qstr; }),
  12.     new ContextSeperator(),
  13.     new ContextItem("删除文档",function(){ var qstr=getCheckboxItem(); location="archives_do.php?qstr="+qstr+"&aid="+aid+"&dopost=delArchives"; }),
  14.     new ContextSeperator(),
  15.     new ContextItem("全部选择",function(){ selAll(); }),
  16.     new ContextItem("取消选择",function(){ noSelAll(); }),
  17.     new ContextSeperator(),
  18.     new ContextItem("频道管理",function(){ location="catalog_main.php"; })
  19.   ]
  20.   ContextMenu.display(popupoptions)
  21. }
复制代码
想加什么随便加 ,我加了三行
  1. new ContextItem("加粗",function(){ var qstr=getCheckboxItem(); location="archives_do.php?aid="+aid+"&dopost=jiachu&qstr="+qstr; }),
  2. new ContextItem("变红",function(){ var qstr=getCheckboxItem(); location="archives_do.php?aid="+aid+"&dopost=bianhong&qstr="+qstr; }),
  3. new ContextItem("变蓝",function(){ var qstr=getCheckboxItem(); location="archives_do.php?aid="+aid+"&dopost=bianlan&qstr="+qstr; }),
复制代码
下一步去找dede\archives_do.php
增加三个选项就是
  1. //加粗
  2. function jiancu();
  3. ---------------------------*/
  4. else if($dopost=="jiachu"
  5. {
  6.         SetPageRank(5);
  7.         if( $aid!="" && !ereg("(".$aid."`|`".$aid."",$qstr) ) $qstr .= "`".$aid;
  8.         if($qstr==""{
  9.           ShowMsg("参数无效!",$ENV_GOBACK_URL);
  10.           exit();
  11.         }
  12.         $qstrs = explode("`",$qstr);
  13.         $dsql = new DedeSql(false);
  14.         foreach($qstrs as $aid)
  15.         {
  16.           $aid = ereg_replace("[^0-9]","",$aid);
  17.           if($aid=="" continue;
  18.           $dsql->SetQuery("Update #@__archives set iscommend='5' where ID='$aid'");
  19.           $dsql->ExecuteNoneQuery();
  20.         }
  21.         $dsql->Close();
  22.         ShowMsg("成功把所选的文档设为推荐!",$ENV_GOBACK_URL);
  23.         exit();
  24. }
  25. /*--------------------------
  26. //变红
  27. function bianhong();
  28. ---------------------------*/
  29. else if($dopost=="bianhong")
  30. {
  31.         SetPageRank(5);
  32.         if( $aid!="" && !ereg("(".$aid."`|`".$aid.")",$qstr) ) $qstr .= "`".$aid;
  33.         if($qstr==""){
  34.           ShowMsg("参数无效!",$ENV_GOBACK_URL);
  35.           exit();
  36.         }
  37.         $qstrs = explode("`",$qstr);
  38.         $dsql = new DedeSql(false);
  39.         foreach($qstrs as $aid)
  40.         {
  41.           $aid = ereg_replace("[^0-9]","",$aid);
  42.           if($aid=="") continue;
  43.           $dsql->SetQuery("Update #@__archives set color='#FF0000' where ID='$aid'");
  44.           $dsql->ExecuteNoneQuery();
  45.         }
  46.         $dsql->Close();
  47.         ShowMsg("成功把所选的文档设为推荐!",$ENV_GOBACK_URL);
  48.         exit();
  49. }
  50. /*--------------------------
  51. //变蓝
  52. function bianlan();
  53. ---------------------------*/
  54. else if($dopost=="bianlan")
  55. {
  56.         SetPageRank(5);
  57.         if( $aid!="" && !ereg("(".$aid."`|`".$aid.")",$qstr) ) $qstr .= "`".$aid;
  58.         if($qstr==""){
  59.           ShowMsg("参数无效!",$ENV_GOBACK_URL);
  60.           exit();
  61.         }
  62.         $qstrs = explode("`",$qstr);
  63.         $dsql = new DedeSql(false);
  64.         foreach($qstrs as $aid)
  65.         {
  66.           $aid = ereg_replace("[^0-9]","",$aid);
  67.           if($aid=="") continue;
  68.           $dsql->SetQuery("Update #@__archives set color='#0000FF' where ID='$aid'");
  69.           $dsql->ExecuteNoneQuery();
  70.         }
  71.         $dsql->Close();
  72.         ShowMsg("成功把所选的文档设为推荐!",$ENV_GOBACK_URL);
  73.         exit();
  74. }
  75. /*--------------------------
复制代码
返回列表