最終效果
1、首先帝國CMS tags默認(rèn)的字段肯定是沒有這些字段的,所以我們就手動(dòng)加幾個(gè)字段。
添加tagimg,path兩個(gè)字段,一個(gè)為封面圖,一個(gè)是地址
類型都是:VARCHAR,長度:200,整理:utf8_general_ci
2、修改后臺(tái)tags添加頁面
打開/e/admin/tags/AddTags.php
里面的表單替換成如下代碼
<form name="form1" method="post" action="ListTags.php"> <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder"> <?=$ecms_hashur['form']?> <tr class="header"> <td height="25" colspan="2"><?=$postword?> <input name="enews" type="hidden" id="enews" value="<?=$enews?>"> <input name="tagid" type="hidden" id="tagid" value="<?=$tagid?>"> <input name="fcid" type="hidden" id="fcid" value="<?=$fcid?>"> </td> </tr> <tr bgcolor="#FFFFFF"> <td height="25">所屬分類:</td> <td height="25"><select name="cid" id="cid"> <option value="0">不分類</option> <?=$cs?> </select> <input type="button" name="Submit62223" value="管理分類" onClick="window.open('TagsClass.php<?=$ecms_hashur['whehref']?>');"></td> </tr> <tr bgcolor="#FFFFFF"> <td width="18%" height="25">TAG名稱:</td> <td width="82%" height="25"> <input name="tagname" type="text" id="tagname" value="<?=$r[tagname]?>" size="42"> <font color="#666666">(最多20個(gè)字)</font> </td> </tr> <tr bgcolor="#FFFFFF"> <td height="25">網(wǎng)頁標(biāo)題:</td> <td height="25"><input name="tagtitle" type="text" id="tagtitle" value="<?=ehtmlspecialchars($r[tagtitle])?>" size="42"> <font color="#666666">(最多60個(gè)字)</font></td> </tr> <tr bgcolor="#FFFFFF"> <td height="25">網(wǎng)頁關(guān)鍵詞:</td> <td height="25"><input name="tagkey" type="text" id="tagkey" value="<?=ehtmlspecialchars($r[tagkey])?>" size="42"> <font color="#666666">(最多100個(gè)字)</font></td> </tr> <tr bgcolor="#FFFFFF"> <td height="25">網(wǎng)頁描述:</td> <td height="25"><textarea name="tagdes" cols="70" rows="8" id="tagdes"><?=$r[tagdes]?></textarea> <font color="#666666">(最多255個(gè)字)</font></td> </tr> <tr bgcolor="#FFFFFF"> <td width="18%" height="25">TAG文件名:</td> <td width="82%" height="25"> <input name="path" type="text" id="path" value="<?=$r[path]?>" size="42"> </td> </tr> <tr bgcolor="#FFFFFF"> <td height="25">TAG縮略圖</td> <td><input name="tagimg" type="text" id="tagimg" value="<?=$r[tagimg]?>" size="38"> <a onClick="window.open('../ecmseditor/FileMain.php<?=$ecms_hashur['whehref']?>&modtype=1&type=1&classid=&doing=2&field=tagimg&filepass=2&sinfo=1','','width=700,height=550,scrollbars=yes');" title="選擇已上傳的圖片"><img src="../../data/images/changeimg.gif" width="22" height="22" border="0" align="absbottom"></a></td> </tr> <tr bgcolor="#FFFFFF"> <td height="25"> </td> <td height="25"> <input type="submit" name="Submit" value="提交"> <input type="reset" name="Submit2" value="重置"></td> </tr> </table> </form>
3、修改數(shù)據(jù)提交,修改
打開/e/admin/tags/ListTags.php
//增加TAGS function AddTags($add,$userid,$username){ global $empire,$dbtbpre; $tagname=RepPostVar($add['tagname']); $cid=(int)$add['cid']; if(!$tagname) { printerror("EmptyTagname","history.go(-1)"); } //驗(yàn)證權(quán)限 CheckLevel($userid,$username,$classid,"tags"); $ecms_fclast=time(); $add['tagtitle']=hRepPostStr(RepPhpAspJspcode($add['tagtitle'])); $add['tagkey']=hRepPostStr(RepPhpAspJspcode($add['tagkey'])); $add['tagdes']=hRepPostStr(RepPhpAspJspcode($add['tagdes'])); $path=$add['path']; $tagimg=$add['tagimg']; $num=$empire->gettotal("select count(*) as total from {$dbtbpre}enewstags where tagname='$tagname' limit 1"); if($num) { printerror("HaveTagname","history.go(-1)"); } $sql=$empire->query("insert into {$dbtbpre}enewstags(tagname,num,isgood,cid,tagtitle,tagkey,tagdes,fclast,path,tagimg) values('$tagname',0,0,'$cid','$add[tagtitle]','$add[tagkey]','$add[tagdes]','$ecms_fclast','$add[path]','$add[tagimg]');"); if($sql) { $tagid=$empire->lastid(); //操作日志 insert_dolog("tagid=$tagid&tagname=$tagname"); printerror("AddTagsSuccess","AddTags.php?enews=AddTags".hReturnEcmsHashStrHref2(0)); } else { printerror("DbError","history.go(-1)"); } } //修改TAGS function EditTags($add,$userid,$username){ global $empire,$dbtbpre; $tagid=(int)$add['tagid']; $tagname=RepPostVar($add['tagname']); $cid=(int)$add['cid']; $path=$add['path']; $tagimg=$add['tagimg']; if(!$tagid||!$tagname) { printerror("EmptyTagname","history.go(-1)"); } //驗(yàn)證權(quán)限 CheckLevel($userid,$username,$classid,"tags"); $ecms_fclast=time(); $add['tagtitle']=hRepPostStr(RepPhpAspJspcode($add['tagtitle'])); $add['tagkey']=hRepPostStr(RepPhpAspJspcode($add['tagkey'])); $add['tagdes']=hRepPostStr(RepPhpAspJspcode($add['tagdes'])); $num=$empire->gettotal("select count(*) as total from {$dbtbpre}enewstags where tagname='$tagname' and tagid<>$tagid limit 1"); if($num) { printerror("HaveTagname","history.go(-1)"); } $sql=$empire->query("update {$dbtbpre}enewstags set tagname='$tagname',cid='$cid',tagtitle='$add[tagtitle]',tagkey='$add[tagkey]',tagdes='$add[tagdes]',fclast='$ecms_fclast',path='$path',tagimg='$tagimg' where tagid='$tagid'"); if($sql) { //操作日志 insert_dolog("tagid=$tagid&tagname=$tagname"); printerror("EditTagsSuccess","ListTags.php?cid=$add[fcid]".hReturnEcmsHashStrHref2(0)); } else { printerror("DbError","history.go(-1)"); } }
怎么使用了,這里有篇文章已經(jīng)介紹了。
最終效果帝國CMS二次開發(fā)tags增加封面圖片步驟1、首先帝國CMS tags默認(rèn)的字段肯定是沒...
點(diǎn)擊查看版權(quán)聲明: 本站資源均來自互聯(lián)網(wǎng)或會(huì)員發(fā)布,如果侵犯了您的權(quán)益請(qǐng)與我們聯(lián)系,我們將在24小時(shí)內(nèi)刪除!謝謝!
轉(zhuǎn)載請(qǐng)注明: 帝國CMS二次開發(fā)tags增加封面圖片