dedecms 栏目增加缩略图的方法 dedecms 栏目怎么增加缩略图
![]() | ![]() | ![]() | ![]() |
| 【性价之王】 | 【线路之王】 | 【价格之王】 | 【配置之王】 |
| 【免费之王】 | 【香港首推】 | 【梯子之王】 | 【独服之王】 |

有时候因为网站功能需求,我们需要为织梦程序的栏目页添加缩略图功能,这里有一个栏目添加缩略图的方法,供大家参考。
涉及到文件如下(请务必提前备份):
dede/catalog_add.php
dede/catalog_edit.php
dede/templets/catalog_add.htm
dede/templets/catalog_edit.htm
打开文件夹 templets 这个目录,在里面新建一个文件夹 typeimg,用于独立存放栏目缩略图。
新加字段 typeimg (用于存放缩略图路径)
后台执行 SQL(前缀默认为 dede_ 具体前缀根据自己网站修改):
alter table `dede_arctype` add `typeimg` char(100) NOT NULL default '';打开 dede/catalog_add.php
查找:
$queryTemplate = "insert into `dede_arctype`将:
(reid,topid,sortrank,typename,typedir,替换为:
(reid,topid,sortrank,typename,typedir,typeimg,将:
('~reid~','~topid~','~rank~','~typename~','~typedir~',替换为:
('~reid~','~topid~','~rank~','~typename~','~typedir~','~typeimg~',打开 dede/catalog_edit.php
查找:
$upquery = "Update `dede_arctype` set在其下面新加一行
`typeimg`='$typeimg',打开 dede/templets/catalog_add.htm 查找
<tr> <td height="26">列表命名规则:</td> <td> <input name="namerule2" type="text" id="namerule2" value="{typedir}/list_{tid}_{page}.html" class="pubinputs" style="width:250px" /> <img src="img/help.gif" alt="帮助" width="16" height="16" border="0" style="cursor:pointer" onClick="ShowHide('helpvar3')"/></td> </tr>在其下面增加以下内容
<tr> <span style="font-family: Arial, Verdana, sans-serif;"> </span><td height="65">栏目图片:</td> <span style="font-family: Arial, Verdana, sans-serif;"> </span><td> <span style="font-family: Arial, Verdana, sans-serif;"> </span><input name="typeimg" type="text" style="width:250px" id="typeimg" class="alltxt" value="" /> <span style="font-family: Arial, Verdana, sans-serif;"> </span><input type="button" name="set9" value="浏览... "class="coolbg np" style="width:60px" onClick="SelectTemplets('form1.typeimg&activepath=%2Ftemplets%2Ftypeimg&img=yes');" /> <span style="font-family: Arial, Verdana, sans-serif;"> </span>(栏目模板里用{dede:field.typeimg /}调用) <span style="font-family: Arial, Verdana, sans-serif;"> </span></td> </tr>打开 dede/templets/catalog_edit.htm 查找
<tr> <span style="font-family: Arial, Verdana, sans-serif;"> </span><td height="26">列表命名规则:</td> <span style="font-family: Arial, Verdana, sans-serif;"> </span><td> <input name="namerule2" type="text" id="namerule2" value="<?php echo $myrow['namerule2']?>" size="40" class="iptxt" /> <span style="font-family: Arial, Verdana, sans-serif;"> </span><img src="img/help.gif" alt="帮助" width="16" height="16" border="0" style="cursor:pointer" onClick="ShowHide('helpvar3')"/></td>< </tr>在其下面新增以下内容:
<tr> <span style="font-family: Arial, Verdana, sans-serif;"> </span><td height="65">栏目图片:</td> <span style="font-family: Arial, Verdana, sans-serif;"> </span><td> <span style="font-family: Arial, Verdana, sans-serif;"> </span><input name="typeimg" type="text" style="width:250px" id="typeimg" class="alltxt" value="<?php echo $myrow['typeimg']?>" /> <span style="font-family: Arial, Verdana, sans-serif;"> </span><input type="button" name="set9" value="浏览... "class="coolbg np" style="width:60px" onClick="SelectImages('form1.typeimg&activepath=%2Ftemplets%2Ftypeimg&img=yes');" /> <span style="font-family: Arial, Verdana, sans-serif;"> </span>(栏目模板里用{dede:field.typeimg /}调用) <span style="font-family: Arial, Verdana, sans-serif;"> </span></td> </tr>完成!
添加或修改图片时在 栏目管理》高级选项上传即可。
如果想同时在文章内容页调用的话,打开 includearc.archives.class.php 查找
if($this->ChannelUnit->ChannelInfos['issystem']!=-1)将
$query = "Select arc.*,tp.reid,tp.typedir,ch.addtable <span style="font-family: Arial, Verdana, sans-serif;"> </span>from `dede_archives` arc <span style="font-family: Arial, Verdana, sans-serif;"> </span>left join dede_arctype tp on tp.id=arc.typeid <span style="font-family: Arial, Verdana, sans-serif;"> </span>left join dede_channeltype as ch on arc.channel = ch.id <span style="font-family: Arial, Verdana, sans-serif;"> </span>where arc.id='$aid' "; $this->Fields = $this->dsql->GetOne($query);替换为
$query = "Select arc.*,tp.reid,tp.typedir,tp.typeimg,ch.addtable <span style="font-family: Arial, Verdana, sans-serif;"> </span>from `dede_archives` arc <span style="font-family: Arial, Verdana, sans-serif;"> </span>left join dede_arctype tp on tp.id=arc.typeid <span style="font-family: Arial, Verdana, sans-serif;"> </span>left join dede_channeltype as ch on arc.channel = ch.id <span style="font-family: Arial, Verdana, sans-serif;"> </span>where arc.id='$aid' "; <span style="font-family: Arial, Verdana, sans-serif;"> </span>$this->Fields = $this->dsql->GetOne($query);OK,给织梦给栏目增加缩略图的方法就介绍到这了,有需要的朋友可以自行参考修改调整。
猜你可能想看的VPS
- LOCVPS 香港邦联全新套餐,高性价比 Cn2 线路,2 核 2G 内香港VPS[主机]
- YonZy→66 元 年 512MB 内存 6GB SSD 空间 不限流虚拟空间(主机)
- 韩国 CN2 $59.5 月 E5-2450L*2 32G 内存 1T 韩国VPS[主机]
- AlphaVPS→保加利亚 VPS 独立服务器 大硬盘 KVM 年付 1独立服务器[U]
- 补货通知 hostdare→CN2 GT 线路和 CN2 GIA 线路同全球[VPS测评]
- 疯狂猜成语 图猜成语一道金砖砌成的墙是什么成语?全球[VPS测评]
- 促销 数脉科技→香港双向 CN2 服务器低至 4 折 E3-1230v2香港VPS[主机]
- 促销 傲游主机→日本大阪终身 75 折 全场 8 折优惠日本VPS[主机]
- 微信开发→"errcode": -1000,"errmsg": "sys全球[VPS测评]
- 疯狂猜成语 图猜成语一个咻字和一只鹤是什么意思?全球[VPS测评]
- WordPress 常用的自定义文字广告、图片广告代码全球[VPS测评]
- GnomeITSolutions 6G大内存50GNVME硬盘不限流VP全球[VPS测评]
- 今日头条欲做号内搜索,可搜站外不少内容全球[VPS测评]
- 网站配置HSTS协议的好处和必要性全球[VPS测评]
- hostnamaste美国独立日促销,KVM VPS 特价机,$24/年独立服务器[U]
- Sincere-月付$20 库拉索VPS(荷兰王国自治领土) 1C1G5全球[VPS测评]
- DMIT.io 香港VPS CVM N3系列香港VPS[主机]
- 2020情人节: CloudCone 512 内存 10G HDD 1T全球[VPS测评]
- jquery css3实现的进度条动画特效,带加载进度条百分比动态效果。全球[VPS测评]
- 青果云怎么样?美国/香港/日本云主机 买多久送多久日本VPS[主机]
- 2022年最新的15个美容院抖音文案,美容院文案怎么写全球[VPS测评]
- 全球云lovps,香港CN2线路vps 新品七折月付49元香港VPS[主机]
- 九零云怎么样?香港将军澳VPS,美国圣何塞VPS 2核1G10M 47/美国VPS[主机]
- 奇维云优惠活动:香港CN21核1G1M带宽云服务器免费领取香港VPS[主机]
- 月神云:洛杉矶CN2 GIA高防vps、香港CN2 GIA VPS全场7香港VPS[主机]
- 小欢互联:洛杉矶高防vps年付138元,香港CN2线路月付8元起,1核/香港VPS[主机]
- PangHost:香港CN2云服务器VPS月付29元,美国洛杉矶高防vp美国VPS[主机]
- HostXen:双十一新用户香港、日本vps,送20元代金券,充值300日本VPS[主机]
- hostkvm怎么样?香港云vps 带宽30M 月付6美元香港VPS[主机]
- 六六云:1核1GB/15GB空间/1T流量/100Mbps/KVM/香港虚拟空间(主机)
转载请注明原文地址:http://140.238.13.167:12355/read-202181.html











