终究作用

帝国CMS二次开发tags添加封面图片过程

1、首要帝国CMS tags默许的字段肯定是没有这些字段的,所以咱们就手动加几个字段。

添加tagimg,path两个字段,一个为封面图,一个是地址

类型都是:VARCHAR,长度:200,收拾:utf8_general_ci

2、修正后台tags添加页面

翻开/e/admin/tags/AddTags.php

里边的表单替换成如下代码

<formname="form1"method="post"action="ListTags.php">
<tablewidth="100%"border="0"align="center"cellpadding="3"cellspacing="1"class="tableborder">
<?=$ecms_hashur['form']?>
<trclass="header">
<tdheight="25"colspan="2"><?=$postword?>
<inputname="enews"type="hidden"id="enews"value="<?=$enews?>"><inputname="tagid"type="hidden"id="tagid"value="<?=$tagid?>">
<inputname="fcid"type="hidden"id="fcid"value="<?=$fcid?>"></td>
</tr>
	<trbgcolor="#FFFFFF">
<tdheight="25">所属分类:</td>
<tdheight="25"><selectname="cid"id="cid">
<optionvalue="0">不分类</option>
		<?=$cs?>
</select>
<inputtype="button"name="Submit62223"value="办理分类"onClick="window.open('TagsClass.php<?=$ecms_hashur['whehref']?>');"></td>
</tr>
<trbgcolor="#FFFFFF">
<tdwidth="18%"height="25">TAG称号:</td>
<tdwidth="82%"height="25"><inputname="tagname"type="text"id="tagname"value="<?=$r[tagname]?>"size="42">
<fontcolor="#666666">(最多20个字)</font></td>
</tr>
<trbgcolor="#FFFFFF">
<tdheight="25">网页标题:</td>
<tdheight="25"><inputname="tagtitle"type="text"id="tagtitle"value="<?=ehtmlspecialchars($r[tagtitle])?>"size="42">
<fontcolor="#666666">(最多60个字)</font></td>
</tr>
<trbgcolor="#FFFFFF">
<tdheight="25">网页关键词:</td>
<tdheight="25"><inputname="tagkey"type="text"id="tagkey"value="<?=ehtmlspecialchars($r[tagkey])?>"size="42">
<fontcolor="#666666">(最多100个字)</font></td>
</tr>
<trbgcolor="#FFFFFF">
<tdheight="25">网页描绘:</td>
<tdheight="25"><textareaname="tagdes"cols="70"rows="8"id="tagdes"><?=$r[tagdes]?></textarea>
<fontcolor="#666666">(最多255个字)</font></td>
</tr>
<trbgcolor="#FFFFFF">
<tdwidth="18%"height="25">TAG文件名:</td>
<tdwidth="82%"height="25"><inputname="path"type="text"id="path"value="<?=$r[path]?>"size="42">
</td>
</tr>
	<trbgcolor="#FFFFFF">
<tdheight="25">TAG缩略图</td>
<td><inputname="tagimg"type="text"id="tagimg"value="<?=$r[tagimg]?>"size="38">
<aonClick="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="挑选已上传的图片"><imgsrc="../../data/images/changeimg.gif"width="22"height="22"border="0"align="absbottom"></a></td>
</tr>
<trbgcolor="#FFFFFF">
<tdheight="25">&nbsp;</td>
<tdheight="25"><inputtype="submit"name="Submit"value="提交"><inputtype="reset"name="Submit2"value="重置"></td>
</tr>
</table>
</form>

3、修正数据提交,修正

翻开/e/admin/tags/ListTags.php

//添加TAGS
functionAddTags($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("selectcount(*)astotalfrom{$dbtbpre}enewstagswheretagname='$tagname'limit1");
	if($num)
	{
		printerror("HaveTagname","history.go(-1)");
	}
	$sql=$empire->query("insertinto{$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
functionEditTags($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("selectcount(*)astotalfrom{$dbtbpre}enewstagswheretagname='$tagname'andtagid<>$tagidlimit1");
	if($num)
	{
		printerror("HaveTagname","history.go(-1)");
	}
	$sql=$empire->query("update{$dbtbpre}enewstagssettagname='$tagname',cid='$cid',tagtitle='$add[tagtitle]',tagkey='$add[tagkey]',tagdes='$add[tagdes]',fclast='$ecms_fclast',path='$path',tagimg='$tagimg'wheretagid='$tagid'");
	if($sql)
	{
		//操作日志
		insert_dolog("tagid=$tagid&tagname=$tagname");
		printerror("EditTagsSuccess","ListTags.php?cid=$add[fcid]".hReturnEcmsHashStrHref2(0));
	}
	else
	{
		printerror("DbError","history.go(-1)");
	}
}

帝国CMS二次开发tags添加封面图片运用

怎样运用了,这里有篇文章现已介绍了。

帝国CMS二次开发tags添加封面图片

帝国cms教程

终究作用帝国CMS二次开发tags添加封面图片过程1、首要帝国CMS tags默许的字段肯定是没...

点击检查

声明:有的资源均来自网络转载,版权归原作者所有,如有侵犯到您的权益 请联系邮箱:123456@qq.com 我们将配合处理!

原文地址:帝国CMS二次开发tags增加封面图片发布于2022-06-20 07:43:29

相关推荐