织梦增加栏目缩略图、栏目图片功能的方法

网站每个栏目都有不同的banner大图,为了方便客户可以直接在后台栏目处添加和更换这个栏目图片,我们需要给dedecms二次开发,增加栏目图片上传选项。

在成都网站制作、成都做网站过程中,需要针对客户的行业特点、产品特性、目标受众和市场情况进行定位分析,以确定网站的风格、色彩、版式、交互等方面的设计方向。创新互联建站还需要根据客户的需求进行功能模块的开发和设计,包括内容管理、前台展示、用户权限管理、数据统计和安全保护等功能。

织梦栏目添加banner大图上传选项

1.先给数据库中的dede_arctype表增加一个字段

后台 - 系统 - 系统设置 - SQL命令行工具

ALTER TABLE `dede_arctype` ADD `typebigpic` CHAR( 255 ) NOT NULL DEFAULT '';

2.打开 \dede\templets\catalog_add.htm 搜索

name="typename"

在它的</tr>下面加入

<script language='javascript' src="js/main.js"></script>
<tr id="pictable">
<td height="24" colspan="6">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="158"> &nbsp;图片地址:</td>
<td width="560">
<table width="100%" border="0" cellspacing="1" cellpadding="1">
<tr>
<td height="30">
<input name="typebigpic" type="text" id="picname"  value="" />
<input type="button" name="Submit2" value="站内选择"  onClick="SelectImage('form1.picname','');" class='np coolbg'/>
</td>
</tr>
</table>
</td>
<td width="270">
<style>
.divpre,.divpre img{height:50px;}
</style>
<img src="images/pview.gif" width="100" height="50" id="picview" name="picview">
</td>
</tr>
</table>
</td>
</tr>

3.打开 \dede\templets\catalog_edit.htm 搜索

name="typename"

在它的</tr>下面加入

<script language='javascript' src="js/main.js"></script>
<tr id="pictable">
<td height="24" colspan="6">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="158"> &nbsp;图片地址:</td>
<td width="560">
<table width="100%" border="0" cellspacing="1" cellpadding="1">
<tr>
<td height="30">
<input name="typebigpic" type="text" id="picname"  value="<?php echo $myrow['typebigpic']?>" />
<input type="button" name="Submit2" value="站内选择"  onClick="SelectImage('form1.picname','');" class='np coolbg'/>
</td>
</tr>
</table>
</td>
<td width="270">
<style>
.divpre,.divpre img{height:50px;}
</style>
<img src="<?php if($myrow['typebigpic']!="") echo $myrow['typebigpic']; else echo "images/pview.gif";?>" width="100" height="50" id="picview" name="picview">
</td>
</tr>
</table>
</td>
</tr>

4.打开 \dede\catalog_add.php 搜索

$in_query = "INSERT INTO `dede_arctype`(reid,topid,sortrank,typename

改成

$in_query = "INSERT INTO `dede_arctype`(reid,topid,sortrank,typename,typebigpic

继续搜索

VALUES('$reid','$topid','$sortrank','$typename'

改成

VALUES('$reid','$topid','$sortrank','$typename','$typebigpic'

5.打开 \dede\catalog_edit.php 搜索

`smalltypes`='$smalltypes'

改成

`smalltypes`='$smalltypes',`typebigpic`='$typebigpic'

6.打开 \include\taglib\channelartlist.lib.php 搜索

typedir

改成

typedir,typebigpic

7.打开 \include\taglib\channel.lib.php 搜索

typedir

改成

typedir,typebigpic

注意:这个文件有4处都需要改

8.打开 \include\taglib\type.lib.php 搜索

typedir

改成

typedir,typebigpic

9.\include\arc.listview.class.php 搜索

//设置环境变量

在它下面添加

$this->Fields['typebigpic'] = $this->TypeLink->TypeInfos['typebigpic'];

后台栏目效果

织梦增加栏目缩略图、栏目图片功能的方法

前台模板中调用标签

{dede:channelartlist}{dede:field.typebigpic/}{/dede:channelartlist}

{dede:channel}[field:typebigpic/]{/dede:channel}

{dede:type}[field:typebigpic/]{/dede:type}

栏目列表页单独调用

{dede:field.typebigpic/}

分享标题:织梦增加栏目缩略图、栏目图片功能的方法
分享路径:https://www.cdcxhl.com/article22/pphscc.html

成都网站建设公司_创新互联,为您提供移动网站建设云服务器外贸建站域名注册网站策划网站设计公司

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

商城网站建设