導航:首頁 > 萬維百科 > 帝國cms批量設置時間

帝國cms批量設置時間

發布時間:2020-10-31 03:53:53

1、帝國cms怎麼批量修改採集來的數據欄位內容信息

進入資料庫後,找到你存放數據的那個表,因為一旦修改的時候出現錯誤的話,你又不知道改回來後果是很嚴重的,建議大家先備份這個表的數據,我來里以表『phome_ecms_news』為例,因為我的數據還沒入庫所以真實要修改的數據是『phome_ecms_infotmp_news』,一定要找對表哦,別亂改。下圖是我所找到的臨時數據對應的表的部分截圖。

核對好數據後只要寫sql語修改表裡的對應欄位的內容信息就可以了,比如我要修改『newstime』發布時間欄位,把有含有『2014-03-15』改成『2012-03-15』只要寫這樣的sql語句
update phome_ecms_infotmp_news set newstime=replace(newstime,'2014-03-12','2012-03-12')
WHERE newstime like '%2014-03-12%' ,點擊SQL,再點擊UPDATE如下圖

把剛剛寫的好sql語句放在上圖中 2 所示的輸入框里,原來有的語句要刪除哦 ,如下圖,再點擊下圖中的『執行』按鈕

出現下圖後點擊圖中我用紅框標出的地方 『創建 PHP 代碼』

點擊 『創建 PHP 代碼』 後出現下圖了,再點擊下圖中的 『執行』按鈕,要往下面拉一點哦,不然可以看不到這個 按鈕
6
現在再看看這個數據表裡的 時間欄位 里的內容,是不是改了,如果你想改標題,只要把上面的sql語句表名,和欄位名改對就行了。

2、帝國CMS 批量修改數據

用帝國做的商城系統,上傳了很多產品圖片,後來要求把縮略圖改小,很傷腦筋,結果找到上面的帖子,但怎麼搞也不行,可能那不是針對6.0.所有自己加以修改終於成功!!!
以下為修改方法:
一、首先,在t_functions.php中添加一下兩個函數
1.function Titlepic_all ($id, $classid, $userid, $username, $pwidth, $pheight)
2. {
3. global $empire,$class_r,$class_zr,$dbtbpre,$keys;
4. $count = count ($id);
5. if (!$count)
6. {
7. printerror ('Noteditpic', 'history.go(-1)');
8. }
9. for ($i = 0; ($i < $count); ++$i)
10. {
11. $r = $empire->fetch1 ('select * from phome_ecms_'.$class_r[$classid][tbname].' where id='.$id[$i].' and titlepic<>""');
12. if(!emptyempty($r[id])){
13. ImageResize("../../".$r[titlepic],$pwidth,$pheight,"../../".$r[titlepic]);
14.
15. }
16. }
17.printerror ('TitlepicAllSuccess', $_SERVER['HTTP_REFERER']);
18. }
19.Function ImageResize($srcFile,$toW,$toH,$toFile="")
20.{
21. global $keys;
22. if($toFile==""){ $toFile = substr($srcFile,0,-4)."small".substr($srcFile,-4); }
23. $info = "";
24. $data = GetImageSize($srcFile,$info);
25. switch ($data[2])
26. {
27. case 1:
28. if(!function_exists("imagecreatefromgif")){
29. echo "你的GD庫不能使用GIF格式的圖片,請使用Jpeg或PNG格式
30.
31.!<a href='<font>javascript:</font>go(-1);'>返回</a>";
32. exit();
33. }
34. $im = ImageCreateFromGIF($srcFile);
35. break;
36. case 2:
37. if(!function_exists("imagecreatefromjpeg")){
38. Echo "你的GD庫不能使用jpeg格式的圖片,請使用其它格式的圖
39.
40.片!<a href='<font>javascript:</font>go(-1);'>返回</a>";
41. Exit();
42. }
43. $im = ImageCreateFromJpeg($srcFile);
44. break;
45. case 3:
46. $im = ImageCreateFromPNG($srcFile);
47. break;
48.}
49.$srcW = ImageSX($im);
50.$srcH = ImageSY($im);
51.$keys= 0;
52.if (($srcW>$toW) or ($srH>$toH)){
53.if(($srcW/$toW)>=($srcH/$toH)){
54. $temp_height=$toH;
55. $temp_width=$srcW/($srcH/$toH);
56. $src_X=Abs(($toW-$temp_width)/2);
57. $src_Y=0;
58. }
59. else{
60. $temp_width=$toW;
61. $temp_height=$srcH/($srcW/$toW);
62. $src_X=0;
63. $src_Y=Abs(($toH-$temp_height)/2);
64. }
65. $temp_img=ImageCreateTrueColor($temp_width,$temp_height);
66. imagecopyResampled($temp_img,$im,0,0,0,0,$temp_width,$temp_height,$srcW,$srcH);
67. $ni=ImageCreateTrueColor($toW,$toH);
68. imagecopyResampled($ni,$temp_img,0,0,$src_X,$src_Y,$toW,$toH,$toW,$toH);
69.
70.if(Function_exists('imagejpeg')) ImageJpeg($ni,$toFile);
71. else ImagePNG($ni,$toFile);
72. ImageDestroy($ni);
73.$keys= 1;
74.}
75.ImageDestroy($im);
76.}

二、修改 e/admin/ListNews.php{還有個頁面:e/admin/ListAllInfo.php},大約在最後幾行「選中全部 </td></tr>」的後面添加以下代碼:
<tr bgcolor="#FFFFFF">
<td height="25" colspan="8"><div align="right">
縮略圖寬: <input name="pwidth" type="text" value="120" width="60">
縮略圖高: <input name="pheight" type="text" value="120" width="60">
<input type="submit" name="Submit355" value="修改縮略圖" onClick="document.listform.enews.value='Titlepic_all';">
</div></td></tr>
其中,圖寬和圖稿的默認值可按自己的情況設定,設定好後,以後操作更方便。
三、在e/admin/ecmsinfo.php中添加如下代碼:
//批量加標題圖片
elseif($enews=="Titlepic_all")
{
$id=$_POST['id'];
$classid=$_POST['classid'];
$bclassid=$_POST['bclassid'];
$pwidth=$_POST['pwidth'];
$pheight=$_POST['pheight'];
Titlepic_all($id,$classid,$logininid,$loginin,$pwidth,$pheight);
}
四、函數中用到「 printerror ('Noteditpic', 'history.go(-1)');」等操作提示,這個提示可加在e/data/language/gb/pub/message.php;當然這一步不加也不影響操作
在message.php 後面加:

'Noteditpic'=>'沒有選擇!',
'TitlepicAllSuccess'=>'操作成功!',

3、帝國cms 批量定時審核 代碼 或者插件 我知道帝國cms 可以設置任務自動刷新首頁和欄目

在首頁模板中加入下面代碼,盡量放在底部。
<script language="javascript" type="text/javascript" src="/e/htmlindex/index_html.php"></script>

在 /e/ 建立文件夾 htmlindex 並設置 777許可權

將下面代碼保存在 /e/htmlindex/index_html.php

修改刷新時間,將文件中1200改為你想要的時間,單位為秒。

<?php
require("../class/connect.php");
include("../class/db_sql.php");
include("../class/config.php");
include("../class/functions.php");
include("../class/t_functions.php");
require LoadLang("pub/fun.php");
require("../data/dbcache/class.php");
require("../data/dbcache/MemberLevel.php");
include("../class/chtmlfun.php"); 
$link=db_connect();
$empire=new mysqlquery();
$filepath_s="indexhtmlhc.txt";
$time=time();
@$filemtime=(int)filemtime($filepath_s)+1200;
/*
函數解釋
file_exists() 函數檢查文件或目錄是否存在。
mkdir() 函數創建目錄。
time() 函數返回當前時間的 Unix 時間戳。
filemtime() 函數返迴文件內容上次的修改時間。
*/
if (!file_exists($filepath_s)){
fopen($filepath_s, 'w');
@chmod($filepath_s, 0777);
ReIndex();
}elseif(!file_exists($filepath_s) || (filemtime($filepath_s)+1200)<time()){
fopen($filepath_s, 'w');
@chmod($filepath_s, 0777);
ReIndex();
}else{
// do nothing
}
db_close();
$empire=null;
?>

4、帝國CMS7.2能不能批量修改信息中的選項設置?求高手解答!

自己寫sql語句,直接在後台執行就OK了

update [!db.pre!]ecms_news set newstempid = 3 where classid = 5;
// 把所有的欄目ID為5的,並且使用的是新聞系統模型的  信息全部修改為內容模版為 3,
// 內容模版ID,請在後台的模版管理,內容模版管理中查看
// 這個sql語句請在後台的    系統設置,左側菜單的最後一項執行sql語句那裡操作就OK了
// 防止操作錯誤,請先進行數據備份再進行上述操作

5、帝國cms 怎麼批量修改文章內容?

默認情況是這么修改的

登錄後台,依次找到 欄目 - 其他相關 - 批量替換欄位值 ,在 選擇替換表 中,找到你所用的表,然後選擇 替換欄位 為 newstext原字元中填寫你網站中存在的電話,新字元填寫你現在的電話,現在選擇 替換,把 正則替換 打上對勾 替換一下就OK了,最後重新生成就可以了

 

6、帝國cms怎麼批量添加信息的tags

修改步驟:
  1、以下代碼加入到admin/ecmsinfo.php,在任意2個elseif中間插入就行
elseif($enews=="AddTags_all")//列表批量添加Tags
{
$classid=$_POST['classid'];
$id=$_POST['id'];
$tags=$_POST['add_listtags'];
$newstime=time();
eInsertTags2($tags,$classid,$id,$newstime);
}
  2、將以下代碼加入到class/uesrfun.php
//加入TAG表
function eInsertTags2($tags,$classid,$id,$newstime){
global $empire,$dbtbpre,$class_r;
if(!trim($tags))
{
printerror("TAGS信息不能為空", "", 1, 0, 1);
return '';
}
$count = count($id); //統計ID數量
$tags = RepPostVar($tags);
$tag = explode(",", $tags);
if (emptyempty($count))
{
printerror("未選擇信息ID", "", 1, 0, 1);
}
if (count($tag)>1)
{
printerror("只能添加一個TAGS詞", "", 1, 0, 1);
}

$classid=(int)$classid;
$id[$i] = (int)$id[$i];
$mid=(int)$class_r[$classid][modid];
for($i=0;$i<$count;$i++)
{
$tbname=$class_r[$classid][tbname];//獲取表名
$r=$empire->fetch1("select tagid from {$dbtbpre}enewstags where tagname='$tags' limit 1");
$t = $empire->fetch1("select infotags from {$dbtbpre}ecms_".$tbname." where id='$id[$i]'");
$taga=$t['infotags'].",".$tags; //組合TAGS
$tagb[$i] = explode(",",$taga); //設置數組
$tagc=array_values(array_unique($tagb[$i])); //數組排重
for($t=0;$t<count($tagc);$t++)
{//二級子循環TAGS數組輸出
$newtags[$i].= ",".$tagc[$t];
}
if($r[tagid])
{
$datar=$empire->fetch1("select tagid,classid,newstime from {$dbtbpre}enewstagsdata where tagid='$r[tagid]' and id='$id[$i]' and mid='$mid' limit 1");
if($datar[tagid])
{
if($datar[classid]!=$classid||$datar[newstime]!=$newstime)
{
$empire->query("update {$dbtbpre}enewstagsdata set classid='$classid',newstime='$newstime' where tagid='$r[tagid]' and id='$id[$i]' and mid='$mid' limit 1");
}
}
else
{
$empire->query("update {$dbtbpre}enewstags set num=num+1 where tagid='$r[tagid]'");
$empire->query("update {$dbtbpre}ecms_".$tbname." set infotags='".trim($newtags[$i],",")."' where id='$id[$i]'");
$empire->query("insert into {$dbtbpre}enewstagsdata(tagid,classid,id,newstime,mid) values('$r[tagid]','$classid','$id[$i]','$newstime','$mid');");
}
}
else
{
$empire->query("update {$dbtbpre}ecms_".$tbname." set infotags='".trim($newtags[$i],",")."' where id='$id[$i]'");
$empire->query("insert into {$dbtbpre}enewstags(tagname,num,isgood,cid) values('$tags',1,0,0);");
$tagid=$empire->lastid();
$empire->query("insert into {$dbtbpre}enewstagsdata(tagid,classid,id,newstime,mid) values('$tagid','$classid','$id[$i]','$newstime','$mid');");
}
}
printerror("批量添加TAGS成功", "", 1, 0, 1);
}
3、信息管理列表模板最後一列修改成以下代碼,在e/data/html/list/文件夾內
<td height="25" colspan="8">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="68%" height="25">
<font color="#666666">備註:多選框藍色為未審核信息;發布者紅色為會員投稿;信息ID粗體為未生成,點擊ID可刷新頁面.</font>
</td>
<td width="32%"> <input type="text" name="add_listtags" id="add_listtags" size="50" value="" />
<input type="submit" name="Submit100" value="添加TAGS" onClick="document.listform.enews.value='AddTags_all';document.listform.action='ecmsinfo.php';">
</td>
</tr>
</table>
</td>

7、如何批量更改表名前綴 帝國cms

你試試使用phpmyadmin 或sql 命令行登陸mysql

語句例:
alter table phome_ecms_news rename to blue_ecms_news;
然後修改 e/config/config.php 中對應的表名前綴為新表名前綴即可。

與帝國cms批量設置時間相關的知識