前台調用欄目時需要顯示圖標,整理一下:
第一步:“系統->SQL命令工具” , 插入sql語句
alter table dede_arctype add imgtype varchar(100)
第二步:進入後台管理文件目錄(默認為:dede目錄),找到”catelog_add.php“下的 228行,把下面的替換默認的(在SQL語句添加了”typeimg“)
$in_query = "INSERT INTO `dede_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`,`typeimg`) VALUES('$reid','$topid','$sortrank','$typename','$typedir','$isdefault','$defaultname','$issend','$channeltype', '$tempindex','$templist','$temparticle','default','$namerule','$namerule2', '$ispart','$corank','$description','$keywords','$seotitle','$moresite','$siteurl','$sitepath','$ishidden','$cross','$crossid','$content','$smalltypes','$typeimg')";
第三步:找到”catelog_edit.php“下的36行把下面的替換默認的(在SQL語句添加了”typeimg“)
$upquery = "UPDATE `dede_arctype` SET issend='$issend', sortrank='$sortrank', typename='$typename', typedir='$typedir', isdefault='$isdefault', defaultname='$defaultname', issend='$issend', ishidden='$ishidden', channeltype='$channeltype', tempindex='$tempindex', templist='$templist', temparticle='$temparticle', namerule='$namerule', namerule2='$namerule2', ispart='$ispart', corank='$corank', description='$description', keywords='$keywords', seotitle='$seotitle', moresite='$moresite', `cross`='$cross', `content`='$content', `crossid`='$crossid', `typeimg`='$typeimg', `smalltypes`='$smalltypes' $uptopsql WHERE id='$id' ";
第四步:進入後台管理文件目錄(默認為:dede目錄)/templets/ 下的 “catalog_add.htm 和 catalog_edit.htm" 文件,再加入下面代碼:
<script language='javascript' src="js/main.js"></script>
並在想放置的位置加入下面代碼:
<tr> <td colspan="2"> <table width="100%" border="0" cellspacing="0" cellpadding="0" > <tbody> <tr> <td width="90" class="bline" height="24"> imgmm:</td> <td class="bline"> <input type="text" name="typeimg" id="imgmm" class="text" /> <input name="imgmm_bt" type="button" class="inputbut" value="浏覽..." onclick="SelectImage('form1.imgmm','big')" /> </td> </tr> </tbody> </table> <input type="hidden" name="dede_addonfields" value="imgmm,img" /> </td> </tr>
第五步:調用欄目通邊 channel 標簽調用,所以要更改, 進入/include/taglib/channel.lib.php文件,找到78行,把以下的代碼替換默認(添加typeimg字段查詢)
if($type=='top') { $sql = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,typeimg From `dede_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,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,content,typeimg From `dede_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,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,typeimg FROM `dede_arctype` WHERE reid='$reid' And ishidden<>1 order by sortrank asc limit 0, $line "; }
最後一步:就是在前台調用了
{dede:channel type='self' typeid='15' row='8' current} <li><a href='[field:typelink/]'>[field:typename/]</a> <img src='[field:typeimg/]' /></li> {/dede:channel}