您现在的位置是:首页 > cms教程 > 帝国CMS教程帝国CMS教程

帝国cms增加tags封面图片的方法

怜云2023-05-14帝国CMS教程已有人查阅

导读帝国cms二次开发tags增加封面图片步骤,1、首先帝国CMS tags默认的字段肯定是没有这些字段的,所以我们就手动加几个字段。

帝国cms二次开发tags增加封面图片步骤
1、首先帝国CMS tags默认的字段肯定是没有这些字段的,所以我们就手动加几个字段。
添加tagimg,path两个字段,一个为封面图,一个是地址
类型都是:VARCHAR,长度:200,整理:utf8_general_ci
2、修改后台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个字)</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">&nbsp;</td>
      <td height="25"> <input type="submit" name="Submit" value="提交"> <input type="reset" name="Submit2" value="重置"></td>
    </tr>
  </table>
</form>

3、修改数据提交,修改
打开/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)");
	}
	//验证权限
	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)");
	}
}

帝国CMS二次开发tags增加封面图片使用方法已完成。

本文标签:

很赞哦! ()

相关源码

  • (自适应)WordPress主题SEO自媒体博客资讯模板RabbitV2.0Rabbit v2.0主题专注于网站搜索引擎优化需求,为博客、自媒体及资讯类网站提供专业的SEO技术解决方案。该主题从架构设计到功能实现均围绕搜索引擎优化理念展开。查看源码
  • 自适应APP应用程序介绍推广落地页pbootcms网站源码下载移动应用开发商设计的营销型落地页模板,基于PbootCMS内核深度开发采用前沿响应式架构,无缝适配手机端操作习惯与PC端展示需求。查看源码
  • (自适应)英文外贸电子设备网站模板三级子目录基于PbootCMS内核开发的响应式英文网站模板,为外贸企业打造,支持多行业快速适配。通过简洁高效的代码架构,帮助企业低成本构建专业海外形象,实现更好客户触达与订单转化。查看源码
  • (自适应响应式)高端网站建设设计公司互联网营销网站pbootcms模板本模板基于PbootCMS内核开发,为网站建设公司和互联网营销企业量身打造。采用响应式设计,适配各种移动设备,提供统一的后台管理体验查看源码
  • (自适应)包装机贴标机设备网站源码免费下载基于PbootCMS内核开发的响应式企业模板,为包装机械、贴标设备等工业领域打造,通过数字化展示提升企业专业形象。查看源码
  • (自适应响应式)HTML5甲醛环境检测网站模板带在线留言和资料下载本模板为甲醛检测与环保科技企业开发,采用PbootCMS内核构建。首页集成空气质量数据可视化模块,服务流程采用时间轴展示设计,检测报告板块支持PDF在线预览功能查看源码
分享笔记 (共有 篇笔记)
验证码: