1 打开dede/temple/catelog_edit.html 在
255行加入
<tr>
<td class='bline' height="65" style="padding-left:10px;">栏目图片:</td>
<td class='bline'>
<input name="arcpic" type="text" style="width:250px" id="typeimg" class="alltxt"
value="<?php echo $myrow['arcpic']?>" />
<input type="button" name="set9" value="浏览... "class="coolbg np" style="width:60px" onClick="SelectImage('form1.typeimg')" />(栏目模板里用{dede:field.typeimg /}调用)
</td>
</tr>
头部加入
<script type="text/javascript" src="js/main.js"></script>
2 打开dede/temple/catelog_add.html 修改同上
3 修改catalog_add.php
76 与79行 增加arcpic变量
$queryTemplate = "insert into `#@__arctype`(reid,topid,sortrank,typename,typedir,isdefault,defaultname,issend,channeltype,tempindex,templist,temparticle,modname,namerule,namerule2,ispart,corank,description,keywords,seotitle,moresite,siteurl,sitepath,ishidden,`cross`,`crossid`,`content`,`smalltypes`,`arcpic`) Values('~reid~','~topid~','~rank~','~typename~','~typedir~','$isdefault','$defaultname','$issend','$channeltype','$tempindex','$templist','$temparticle','default','$namerule','$namerule2','0','0','','','~typename~','0','','','0','0','0','','','$arcpic')";
4 修改catalog_editphp 61行加入
`arcpic`='$arcpic',
以便读取数据
5 打开DEDE后台:系统》SQL命令行工具》 右侧 选择单行命令(支持简单查询),然后执行以下语句:
ALTER TABLE `dede_arctype` ADD `arcpic` VARCHAR( 200 ) NULL
6 打开include》taglib》channel.lib.php 文件,找到第80行 将字段arcpic 添加上;如
if($type=='top')
{
$sql = "SELECT id,typename,arcpic,typelitpic,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath
From `#@__arctype` WHERE reid=0 And ishidden<>1 order by sortrank asc limit 0, $line ";
}
else if($type=='son')
{
if($typeid==0) return '';
$sql = "SELECT id,typename,arcpic,typelitpic,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath
From `#@__arctype` WHERE reid='$typeid' And ishidden<>1 order by sortrank asc limit 0, $line ";
}
else if($type=='self')
{
if($reid==0) return '';
$sql = "SELECT id,typename,arcpic,typelitpic,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath
FROM `#@__arctype` WHERE reid='$reid' And ishidden<>1 order by sortrank asc limit 0, $line ";
}
7 首页调用:
{dede:channel typeid='3' row='6'}
<li><a href="[field:typelink/]" target="_blank"><img src="[field:arcpic/]" alt="[field:typename/]" width="135" height="95" />[field:typename/]</a></li>
{/dede:channel}
列表页调用 :{dede:field.arcpic/}