e/class/userfun.php添加函數(shù)
//批量復(fù)制TAGS到關(guān)鍵詞function eCopyTag2Key($classid,$id,$newstime){? ?global $empire,$dbtbpre,$class_r;? ?$count = count($id); //統(tǒng)計(jì)ID數(shù)量? ?if (empty($count))? ?{//如果id沒(méi)選中? ? ? ?printerror("未選擇信息ID", "", 1, 0, 1);? ?}? ?$classid=(int)$classid;//這一步可省略? ?$mid=(int)$class_r[$classid][modid];//取modid值,這一步可省略? ?for($i=0;$i<$count;$i++)? ?{? ? ? ?$id[$i] = (int)$id[$i];? ? ? ?$tbname=$class_r[$classid][tbname];//獲取表名? ? ? ?$r = $empire->fetch1("select * from {$dbtbpre}ecms_".$tbname." where id='$id[$i]' limit 1");? ? ? ?$t = $empire->fetch1("select infotags from {$dbtbpre}ecms_".$tbname."_data_".$r['stb']." where id='$id[$i]'");//從信息表中取infotags和keyboard值? ? ? ?$t=array_merge($r,$t);? ? ? ?$taga=$t['infotags'].",".$t['keyboard']; //組合TAGS:在原有的infotags值上加上新keyboard? ? ? ?$tagb[$i] = explode(",",$taga); //設(shè)置數(shù)組:用,分割tag? ? ? ?$tagc=array_values(array_unique($tagb[$i])); //數(shù)組排重:排除重復(fù)?? ? ? ?for($t=0;$tquery("update {$dbtbpre}ecms_".$tbname." set keyboard='".trim($newtags[$i],",")."' where id='$id[$i]'");//將新生成的keyboard寫(xiě)入到表中? ?}? ?printerror("已成功將TAGS批量復(fù)制到關(guān)鍵詞字段", "", 1, 0, 1);}//加入TAG表function eInsertTags2($tags,$classid,$id,$newstime){? ?global $empire,$dbtbpre,$class_r;? ?$tags = RepPostVar($tags);? ?//$tag = explode(",", $tags);? ?$count = count($id); //統(tǒng)計(jì)ID數(shù)量? ?if (empty($count))? ?{//如果id沒(méi)選中? ? ? ?printerror("未選擇信息ID", "", 1, 0, 1);? ?}? ?$classid=(int)$classid;? ?$mid=(int)$class_r[$classid][modid];//取modid值? ?for($i=0;$i<$count;$i++)? ?{? ? ? ?$id[$i] = (int)$id[$i];? ? ? ?$tbname=$class_r[$classid][tbname];//獲取表名? ? ? ?$r1 = $empire->fetch1("select * from {$dbtbpre}ecms_".$tbname." where id='$id[$i]' limit 1");? ? ? ?$t = $empire->fetch1("select infotags from {$dbtbpre}ecms_".$tbname."_data_".$r1['stb']." where id='$id[$i]'");//從信息表中取infotags和keyboard值? ? ? ?$t=array_merge($r1,$t);? ? ? ?$taga=$t['infotags'].",".$tags; //組合TAGS:在原有的infotags值上加上新tag? ? ? ?$tagb[$i] = explode(",",$taga); //設(shè)置數(shù)組:用,分割tag? ? ? ?$tagc=array_values(array_unique($tagb[$i])); //數(shù)組排重:排除重復(fù)?? ? ? ?for($t=0;$tfetch1("select tagid from {$dbtbpre}enewstags where tagname='$tagc[$t]' limit 1");//查詢(xún)有無(wú)同名的tag? ? ? ? ? ? ? ?if($r[tagid])? ? ? ? ? ? ? ?{//如果有tagid,即enewstags表中有相同tag? ? ? ? ? ? ? ? ? ?$datar=$empire->fetch1("select tagid,classid,newstime from {$dbtbpre}enewstagsdata where tagid='$r[tagid]' and id='$id[$i]' and mid='$mid' limit 1");//用tagid,id和mid對(duì)enewstagsdata進(jìn)行查詢(xún)? ? ? ? ? ? ? ? ? ?if($datar[tagid])? ? ? ? ? ? ? ? ? ?{//如果有數(shù)據(jù)? ? ? ? ? ? ? ? ? ? ? ?if($datar[classid]!=$classid||$datar[newstime]!=$newstime)? ? ? ? ? ? ? ? ? ? ? ?{//如果classid和newstime不相同? ? ? ? ? ? ? ? ? ? ? ? ? ?$empire->query("update {$dbtbpre}enewstagsdata set classid='$classid',newstime='$newstime' where tagid='$r[tagid]' and id='$id[$i]' and mid='$mid' limit 1");//則開(kāi)始更新? ? ? ? ? ? ? ? ? ? ? ?}? ? ? ? ? ? ? ? ? ?}? ? ? ? ? ? ? ? ? ?else? ? ? ? ? ? ? ? ? ?{//查詢(xún)后沒(méi)有此數(shù)據(jù),則先更新enewstags表,在數(shù)量上加1? ? ? ? ? ? ? ? ? ? ? ?$empire->query("update {$dbtbpre}enewstags set num=num+1 where tagid='$r[tagid]'");? ? ? ? ? ? ? ? ? ? ? ?$empire->query("update {$dbtbpre}ecms_".$tbname."_data_".$r1['stb']." set infotags='".trim($newtags[$i],",")."' where id='$id[$i]'");//然后在信息表infotags字段中加上這個(gè)新tag,如果按舍得的方法,這一步就可以免了? ? ? ? ? ? ? ? ? ? ? ?$empire->query("insert into {$dbtbpre}enewstagsdata(tagid,classid,id,newstime,mid) values('$r[tagid]','$classid','$id[$i]','$newstime','$mid');");//然后在enewstagsdata表中插入這些數(shù)據(jù)? ? ? ? ? ? ? ? ? ?}? ? ? ? ? ? ? ?}? ? ? ? ? ? ? ?else? ? ? ? ? ? ? ?{//如果沒(méi)有此tag? ? ? ? ? ? ? ? ? ?$empire->query("update {$dbtbpre}ecms_".$tbname."_data_".$r1['stb']." set infotags='".trim($newtags[$i],",")."' where id='$id[$i]'");//先在信息表中加上此tag,如果按舍得的方法,這一步就可以免了? ? ? ? ? ? ? ? ? ?$empire->query("insert into {$dbtbpre}enewstags(tagname,num,isgood,cid) values('$tagc[$t]',1,0,0);");//在enewstags表中插入新值? ? ? ? ? ? ? ? ? ?$tagid=$empire->lastid();//把這個(gè)tagid給取出來(lái)? ? ? ? ? ? ? ? ? ?$empire->query("insert into {$dbtbpre}enewstagsdata(tagid,classid,id,newstime,mid) values('$tagid','$classid','$id[$i]','$newstime','$mid');");//既然是沒(méi)有tagid的,那就在enewstagsdata也得插入新值(不用再查詢(xún))? ? ? ? ? ? ? ?} ? ? ? ? ? ?? ? ? ?}? ?}? ?printerror("批量添加TAGS成功", "", 1, 0, 1);}eadminecmsInfo.php我加在了123-137行,你們隨意elseif($enews=="CopyTag2Key")//列表批量復(fù)制Tags為關(guān)鍵詞{? ? ? ? ? ? ? ?$classid=$_POST['classid'];? ? ? ? ? ? ? ?$id=$_POST['id'];? ? ? ?$newstime=time(); ?? ? ? ?eCopyTag2Key($classid,$id,$newstime);}elseif($enews=="AddTags_all")//列表批量添加Tags{? ? ? ? ? ? ? ?$classid=$_POST['classid'];? ? ? ? ? ? ? ?$id=$_POST['id'];? ? ? ? ? ? ? ?$tags=$_POST['add_listtags'];? ? ? ?$newstime=time(); ?? ? ? ?eInsertTags2($tags,$classid,$id,$newstime);} e/data/html/list/listinfo.php
???????? ? ? ?備注:多選框藍(lán)色為未審核信息;發(fā)布者紅色為會(huì)員投稿;信息ID粗體為未生成,點(diǎn)擊ID可刷新頁(yè)面. 改為
備注:1.先選中要操作的ID,然后在左側(cè)文本框內(nèi)直接輸入多個(gè)關(guān)鍵詞,以","隔開(kāi);然后點(diǎn)擊批量添加TAGS即可;之后可點(diǎn)擊"批量復(fù)制TAGS"將TAG復(fù)制到關(guān)鍵詞字段.
2.多選框藍(lán)色為未審核信息;發(fā)布者紅色為會(huì)員投稿;信息ID粗體為未生成,點(diǎn)擊ID可刷新頁(yè)面.
新聞熱點(diǎn)
疑難解答
圖片精選