dedecms 后台栏目添加图片
程序员文章站
2022-04-26 19:48:55
...
前台调用栏目时需要显示图标,整理一下:
~typename~ "}
[field:typename/]
{/dede:channel}
第一步:“系统->SQL命令工具” , 插入sql语句
alter table dede_arctype add imgtype varchar(100)
第二步:进入后台管理文件目录(默认为:dede目录),找到”catelog_add.php“下的 228行,把下面的替换默认的(在SQL语句添加了”typeimg“)
$in_query = "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`,`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 `#@__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" style="margin-bottom:3px;">
tbody>
tr>
td width="90" class="bline" height="24"> imgmm:td>
td class="bline">
input type="text" name="typeimg" id="imgmm" style="width:300px" 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 `#@__arctype` WHERE reid=0 And ishidden1 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 `#@__arctype` WHERE reid='$typeid' And ishidden1 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 `#@__arctype` WHERE reid='$reid' And ishidden1 order by sortrank asc limit 0, $line "; }
最后一步:就是在前台调用了
{dede:channel type='self' typeid='15' row='8' currentstyle="
上一篇: php中date() 函数详解(1/2)_PHP教程
下一篇: php运算符优先级