• 微信号
  • 微信号
您当前的位置:首页 > 资源分享 > 插件分享>帝国cms7.5批量推送信息到分类标题插件

帝国cms7.5批量推送信息到分类标题插件

孤峰 孤峰家 2023-06-02 198人阅读

DedeCMS提示信息

帝国cms实现批量推送信息到标题分类,原理和推荐到专题一样,可以通过后台多选然后推送,这样可以提高后台编辑效率,不用一条条修改。下面是孤峰家根据帝国cms论坛上sbgl发布的插件,进行了优化整理,供大家参考。

第一步,在e/admin/文件夹下新建一个文件夹pushinfotype,再新建一个php文件,命名为PushToInfoType.php。将下列代码粘贴到PushToInfoType.php。

<?php 
ini_set("display_errors", "On"); 
error_reporting(E_ALL | E_STRICT); 
define('EmpireCMSAdmin','1'); 
require("../../class/connect.php"); 
require("../../class/db_sql.php"); 
require("../../class/functions.php"); 
require "../".LoadLang("pub/fun.php"); 
require("../../class/t_functions.php"); 
require("../../data/dbcache/class.php"); 
require("../../data/dbcache/MemberLevel.php"); 
require("../../class/chtmlfun.php"); 
$link=db_connect(); 
$empire=new mysqlquery(); 
$editor=1; 
//验证用户 
$lur=is_login(); 
$logininid=$lur['userid']; 
$loginin=$lur['username']; 
$loginrnd=$lur['rnd']; 
$loginlevel=$lur['groupid']; 
$loginadminstyleid=$lur['adminstyleid']; 
//ehash 
$ecms_hashur=hReturnEcmsHashStrAll(); 
//推送信息到标题分类 
function PushInfoToType($add,$userid,$username){ 
global $empire,$dbtbpre,$lur,$class_r; 
$classid=(int)$add['classid']; 
$cid=(int)$add['cid']; 
$id=explode(',',$add[ids]); 
$count=count($id); 
//表名 
$tbname=''; 
if($classid) 
{ 
$tbname=$class_r[$classid]['tbname']; 
} 
if(!$tbname) 
{ 
printerror('ErrorUrl',''); 
} 
for($i=0;$i<$count;$i++) 
{ 
$myid=intval($id[$i]); 
$empire->query("update {$dbtbpre}ecms_".$tbname." SET ttid='$cid' where classid='$classid' and id='$myid'"); 
} 
ReTtHtml($cid); //刷新标题分类 
echo"<script>alert('标题分类成功');window.close();</script>"; 
exit(); 
} 
$enews=$_POST['enews']; 
if(empty($enews)) 
{$enews=$_GET['enews'];} 
if($enews=='PushInfoToType')//推送标题分类 
{ 
PushInfoToType($_POST,$logininid,$loginin); 
} 
$add=''; 
//分类 
$cid=(int)$_GET['cid']; 
//栏目 
$classid=(int)$_GET['classid']; 
//ID 
$ids=RepPostStr($_GET['id'],1); 
if(!$ids) 
{ 
echo"<script>alert('请选择信息');window.close();</script>"; 
exit(); 
} 
//标题分类 
$cttidswhere=''; 
$tts=''; 
$caddr=$empire->fetch1("select ttids from zhuanti_enewsclassadd where classid='$classid'"); 
$modid=7; 
if($caddr['ttids']!='-') 
{ 
if($caddr['ttids']&&$caddr['ttids']!=',') 
{ 
$cttidswhere=' and typeid in ('.substr($caddr['ttids'],1,-1).')'; 
} 
$ttsql=$empire->query("select typeid,tname from zhuanti_enewsinfotype where mid='$modid'".$cttidswhere." order by myorder"); 
while($ttr=$empire->fetch($ttsql)) 
{ 
$select=''; 
$tts.="<option value='$ttr[typeid]'".$select.">$ttr[tname]</option>"; 
} 
} 
?> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
<title>推送信息到标题分类</title> 
<link href="../adminstyle/<?=$loginadminstyleid?>/adminstyle.css" rel="stylesheet" type="text/css"> 
</head> 
<body> 
<table width="100%" border="0" cellspacing="1" cellpadding="3"> 
<tr> 
<td>位置: 设置信息标题分类 
<div align="right"> </div></td> 
</tr> 
</table> 
<form name="form1" method="post" action="PushToInfoType.php"> 
<table width="100%" border="0" cellspacing="1" cellpadding="3"> 
<?=$ecms_hashur['form']?> 
<tr> 
<td>信息ID:<?=$ids?></td> 
</tr> 
</table> 
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder"> 
<tr class="header"> 
<td width="100%" height="25"> <div align="center">所属分类</div></td> 
</tr> 
<tr bgcolor="#FFFFFF" id="chsp"> 
<td> 
<div align="center"> 
<?=$tts?"<select name='cid'><option value='0'>标题分类</option>$tts</select>":""?> 
</div></td> 
</tr> 
<tr bgcolor="#FFFFFF"> 
<td height="25"><div align="center"> 
<input type="submit" name="Submit2" value="确定推送"> 
<input type="button" name="Submit3" value="取消" onclick="window.close();"> 
<input name="enews" type="hidden" id="enews" value="PushInfoToType"> 
<input name="classid" type="hidden" id="classid" value="<?=$classid?>"> 
<input name="ids" type="hidden" id="ids" value="<?=$ids?>"> 
</div></td> 
</tr> 
</table> 
</form> 
</body> 
</html> 
<? 
db_close(); 
$empire=null; 
?>

如图:

接下来我再说明下要修改的地方:

1、75行,select ttids from zhuanti_enewsclassadd,这里我的数据库表前缀是zhuanti_,改成你自己的数据库表前缀,比如帝国cms默认的数据库表前缀phome_

2、83行,select typeid,tname from zhuanti_enewsinfotype,同上一步一样,修改数据库表前缀zhuanti_,改成你自己的数据库表前缀。

=7;这是数据库表模型,如果是新闻数据库表模型,这里改成1,可以在“系统”-“数据表与系统模型”-“管理数据表”查看ID号。

第二步,修改/e/data/html/list/listinfo.php文件,在</script>之前,加上下面的代码:

function PushToInfoType(form) 
{ 
var id=''; 
id=GetSelectId(form); 
if(id=='') 
{ 
alert('请选择要推送的信息'); 
return false; 
} 
window.open('pushinfotype/PushToInfoType.php?<?=$ecms_hashur['ehref']?>&classid=<?=$classid?>&id='+id,'PushToInfoType','width=360,height=500,scrollbars=yes,left=300,top=150,resizable=yes'); 
}

第三步,在:<input type="button" name="Submit52" value="推送至专题" onClick="PushInfoToZt(this.form);">(大概396行)这行下增加:

<input type="button" name="Submit54" value="推送标题分类" onClick="PushToInfoType(this.form);">

较后,保存后,到后台看有没有推送按钮,测试是否成功

帝国cms 批量推送 标题分类 插件

转载:感谢您阅览DedeCMS提示信息,转载请注明文章出处“来源从小爱孤峰知识网:一个分享知识和生活随笔记录的知识小站”。

链接:帝国cms7.5批量推送信息到分类标题插件http://www.gufeng7.com/plug/239.html

联系:如果侵犯了你的权益请来信告知我们删除。邮箱:119882116@qq.com

上一篇: 帝国cms仿畅言评论插件

下一篇: 很抱歉没有了