溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

織夢增加欄目縮略圖、欄目圖片功能的方法

發(fā)布時間:2020-02-25 07:43:26 來源:網(wǎng)絡(luò) 閱讀:240 作者:gutaotao1989 欄目:web開發(fā)

網(wǎng)站每個欄目都有不同的banner大圖,為了方便客戶可以直接在后臺欄目處添加和更換這個欄目圖片,我們需要給dedecms二次開發(fā),增加欄目圖片上傳選項(xiàng)。

織夢欄目添加banner大圖上傳選項(xiàng)

1.先給數(shù)據(jù)庫中的dede_arctype表增加一個字段

后臺 - 系統(tǒng) - 系統(tǒng)設(shè)置 - 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="站內(nèi)選擇"??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="站內(nèi)選擇"??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

繼續(xù)搜索

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 搜索

//設(shè)置環(huán)境變量

在它下面添加

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

后臺欄目效果

織夢增加欄目縮略圖、欄目圖片功能的方法

前臺模板中調(diào)用標(biāo)簽

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

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

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

欄目列表頁單獨(dú)調(diào)用

{dede:field.typebigpic/}


向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI