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
- DogYun 动态云全场 8 折 经典云香港 CMI 月付 39 元起香港VPS[主机]
- 企鹅小屋→2400 元 季 E5-2630L 16GB 内存 240GB香港VPS[主机]
- php 判断数组中是否存在指定键(key)的两种方法全球[VPS测评]
- RAKsmart→日本站群服务器 50M 带宽 258IP 每月 241站群服务器[IP]
- LunaNode→加拿大 法国按小时计费 KVM 月费 3.5 美元起全球[VPS测评]
- 7 折活动 $1.4 月 512M 内存 1T 月流量 100M 带宽全球[VPS测评]
- 手字下面有个天是什么成语?全球[VPS测评]
- 疯狂猜成语 图猜成语一个富字一个贵字在云彩上是什么成语?全球[VPS测评]
- js 数字比较大小的注意事项→10 以上的数字必须转换类型全球[VPS测评]
- 大盘鸡 BackupTank→$10 月 1GB 内存 1TB 空间 2虚拟空间(主机)
- Pyclouds→352 元 月 1GB 内存 20GB 空间 不限流量虚拟空间(主机)
- ITLDC - BlackFriday 黑五 VPS4 折促销 9 机房全球[VPS测评]
- 搬瓦工→新增 10Gbps 带宽的 cn2 gia 线路 VPS 移动+全球[VPS测评]
- .CC 域名获工信部注册备案许可全球[VPS测评]
- CCleaner Pro 最新版 免注册码 绿色破解全球[VPS测评]
- 搬瓦工年付19.99刀10G KVM CN2传家宝全球[VPS测评]
- HostYun 全场9折优惠 月付15.3元 大带宽 512M 10G 全球[VPS测评]
- TmhHost洛杉矶CN2GIA/洛杉矶高防/香港 CN2/洛杉矶大带宽香港VPS[主机]
- Olvps → 256M内存 5G 储存 512G流量 30Mbps 全球[VPS测评]
- 瓜云互联怎么样?香港/美国洛杉矶CN2高防vps 50G月付34元美国VPS[主机]
- RAKsmart:1核1GB/40GB空间/不限流量/15Mbps/KV虚拟空间(主机)
- HTML5绿色有机食品电商网站模板 - Organtio全球[VPS测评]
- wikihost,微基主机服务,100M带宽香港tudcloud,5G防香港VPS[主机]
- 云计算拯救互联网巨头?全球[VPS测评]
- 啤啤云怎么样?香港CN2线路vps,有香港安畅机房,全部9折,38.7元香港VPS[主机]
- 磐逸云怎么样?香港沙田cn2vps 带宽5M年付128元香港VPS[主机]
- 触摸云:喜迎新春回馈活动_香港/美国VPS全场特惠价85折起_续费同价!美国VPS[主机]
- RAKsmart:1核1GB/40GB空间/不限流量/15Mbps/KV虚拟空间(主机)
- 2022年黄河流域跨境电商博览会将于8月26日至28日在青岛西海岸新区举全球[VPS测评]
- 为什么大家都选择香港服务器建站香港VPS[主机]
转载请注明原文地址:http://140.238.13.167:12355/read-202181.html











