14 849 2021-02-21 16:11:22
收藏帝国CMStag作为信息聚合页,应用十分广泛。但作为聚合页,没有配图无疑让页面少了许多生趣。只是,帝国cms没有tag封面图的功能,所以我们只能自己做二次开发。
那么,怎样做帝国cms的tag页封面图片呢?
手动到数据库phome_enewstags增加以下2个字段:添加tagimg(封面图),path(封面图名字)字段
类型都是:VARCHAR,长度:200,格式:utf8_general_ci
打开文件
/e/admin/tags/AddTags.php
找到里面的form标签,并替换成如下代码
<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个字)</font> </td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="25">网页标题:</td>
<td height="25"><input name="tagtitle" type="text" id="tagtitle" value="<?=ehtmlspecialchars($r[tagtitle])?>" size="42">
<font color="#666666">(最多60个字)</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="25">网页关键词:</td>
<td height="25"><input name="tagkey" type="text" id="tagkey" value="<?=ehtmlspecialchars($r[tagkey])?>" size="42">
<font color="#666666">(最多100个字)</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="25">网页描述:</td>
<td height="25"><textarea name="tagdes" cols="70" rows="8" id="tagdes"><?=$r[tagdes]?></textarea>
<font color="#666666">(最多255个字)</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>
打开文件
/e/admin/tags/ListTags.php
从增加tags处开始,替换增加TAGS、修改TAGS
//增加TAGS
function AddTags($add,$userid,$username){
global $empire,$dbtbpre;
$tagname=RepPostVar($add['tagname']);
$cid=(int)$add['cid'];
if(!$tagname)
{
printerror("EmptyTagname","history.go(-1)");
}
//验证权限
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)");
}
//验证权限
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)");
}
}
本文地址:https://xzo.com.cn/develop/empire/634.html
如果您认可我们的分享,有意与我们合作开展帝国cms网站建设与开发业务或插件定制,请联系右侧在线客服。我们能给您的,就是高质量的模板与售后。
标注了信息来源为下载鸥的文章皆为原创,如果是转载的优质文章,我们也都标注了出处。如果您喜欢我们的文章,请按照下载鸥所标注的文章出处进行标注,谢谢您的配合。
帝国cms是一款功能极为强大的cms程序,性能强悍、安全性高,可轻松支持10万数据,高级开发人员可制作出能容纳千万数据量的网站,是国内最出色的开源cms程序之一,推荐企业用户使用。
当前最新版本为7.5,8.0版本即将上线,新版本的核心优化点在于多终端的适配。
一些颜色比较丰富的站点对模板的样式有要求,例如隔行变色:一行默认色,一行红色...
网站留言板是用户留存的重要环节,但帝国cms自带的留言板功能十分单一,大多数...
在帝国cms的开发应用中,标题作为文章的主体往往需要表意明显才能获得更好的...
很多朋友用惯了织梦CMS,转到帝国之后就非常困惑,因为织梦CMS的文章是有一个se...
帝国CMS官方默认后台挺难看的,如果自用还可以,给客户则可能让客户怀疑你的审...
现在采集网站非常多,不止采集内容,还采集图片,还不标注出处,非常可恶。那么,帝国...
在网站运营过程中,我们可能因为这样那样的原因需要批量删除大批文章信息,几十...
帝国cms默认是不允许修改系统模型ID的,因为一旦修改牵扯较大。那么,如果一定...
在一些需要控制用户输入字数的站点中,增加用户输入字数的实时提示无疑十分友...
帝国CMS的信息是绑定内容模板的,通过本教程可以实现在前台自由使用不同的模...
有时候需要在内容页做一些漂亮的格式,或者特殊的应用,比如获取所有分页数量和...
帝国CMS作为最强大的开源cms之一,其程序效率毫无疑问。但,帝国CMS真的可以做...
帝国cm后台权限检测判断代码大全,包括信息管理、栏目管理、模板管理、用户面...
帝国CMS登录后一片空白的原因较多,本方案排除了php配置文件php.ini中的short...
很多技术分享型站点转载了外站不少信息,部分有素质的站长会展示信息来源并链...
今天有客户很困惑的问鸥哥:现在大家都用小程序了,做网站还有意义吗?如果有,又有...