GVKun编程网logo

dedecms织梦程序给栏目增加缩略图办法(织梦如何给栏目增加缩略图)

11

本文将分享dedecms织梦程序给栏目增加缩略图办法的详细内容,并且还将对织梦如何给栏目增加缩略图进行详尽解释,此外,我们还将为大家带来关于DedeCms栏目增加缩略图功能的办法、DedeCms栏目增

本文将分享dedecms织梦程序给栏目增加缩略图办法的详细内容,并且还将对织梦如何给栏目增加缩略图进行详尽解释,此外,我们还将为大家带来关于DedeCms 栏目增加缩略图功能的办法、DedeCms 栏目增加缩略图功能的方法、DedeCms 给栏目增加缩略图(5.5/5.6通用)、dedecms织梦怎样根据不同栏目显示不同的默认缩略图的相关知识,希望对你有所帮助。

本文目录一览:

dedecms织梦程序给栏目增加缩略图办法(织梦如何给栏目增加缩略图)

dedecms织梦程序给栏目增加缩略图办法(织梦如何给栏目增加缩略图)

 

有时候因为网站功能需求,我们需要为织梦程序的列表页添加缩略图功能,这里有一个栏目添加缩略图的办法,供大家参考。

涉及到文件如下(注意备份):

dede/cata日志_add.php

dede/cata日志_edit.php

dede/templets/cata日志_add.htm

dede/templets/cata日志_edit.htm

打开文件夹templets这个目录,在里面新建一个文件夹typeimg,用于独立存放栏目缩略图

新加字段 typeimg

后台执行SQL(前缀默认为dede_ 具体前缀根据自己网站修改):

alter table `dede_arctype` add `typeimg` char(100) NOT NULL default '';

打开dede/cata日志_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/cata日志_edit.php

查找:

 

$upquery = "Update `dede_arctype` set 在其下面新加一行

`typeimg`='$typeimg', 打开dede/templets/cata日志_add.htm 查找

<tr> <td height="26">列表命名规则:</td> <td> <input name="namerule2" type="text" id="namerule2" value="{typedir}/list_{tid}_{page}.html"/> <img src=http://www.dede58.com/a/dedejq/"img/help.gif" alt="帮助" width="16" height="16" border="0"onClick="ShowHide('helpvar3')"/></td> </tr> 

在其下面增加以下内容

         <tr> <td height="65">栏目图片:</td> <td> <input name="typeimg" type="text"id="typeimg"value="" /> <input type="button" name="set9" value="浏览... "onClick="SelectTemplets('form1.typeimg&activepath=%2Ftemplets%2Ftypeimg&img=yes');" /> (栏目源码里用{dede:field.typeimg /}调用) </td> </tr> 打开dede/templets/cata日志_edit.htm 查找

<tr> <td height="26">列表命名规则:</td> <td> <input name="namerule2" type="text" id="namerule2" value="<?php echo $myrow['namerule2']?>" size="40"/> <img src=http://www.dede58.com/a/dedejq/"img/help.gif" alt="帮助" width="16" height="16" border="0"onClick="ShowHide('helpvar3')"/></td> </tr> 在其下面新增以下内容:

<tr> <td height="65">栏目图片:</td> <td> <input name="typeimg" type="text"id="typeimg"value="<?php echo $myrow['typeimg']?>" /> <input type="button" name="set9" value="浏览... "onClick="SelectImages('form1.typeimg&activepath=%2Ftemplets%2Ftypeimg&img=yes');" /> (栏目源码里用{dede:field.typeimg /}调用) </td> </tr> 完成!
 

添加或修改图片时在 栏目管理》高级选项上传即可。

 

如果想同时在新闻内容详细页调用打开\include\arc.archives.class.php 查找

if($this->ChannelUnit->ChannelInfos['issystem']!=-1) 将

$query = "Select arc.*,tp.reid,tp.typedir,ch.addtable from `dede_archives` arc left join dede_arctype tp on tp.id=arc.typeid left join dede_channeltype as ch on arc.channel = ch.id where arc.id='$aid' "; $this->Fields = $this->dsql->GetOne($query); 替换为

#p#分页标题#e#

$query = "Select arc.*,tp.reid,tp.typedir,tp.typeimg,ch.addtable from `dede_archives` arc left join dede_arctype tp on tp.id=arc.typeid left join dede_channeltype as ch on arc.channel = ch.id where arc.id='$aid' "; $this->Fields = $this->dsql->GetOne($query);

 

OK,给织梦给栏目增加缩略图的办法就介绍到这了,有需要的朋友可以自行参考修改调整。

本文章网址:http://www.ppssdd.com/code/14787.html。转载请保留出处,谢谢合作!

DedeCms 栏目增加缩略图功能的办法

DedeCms 栏目增加缩略图功能的办法

 

此功能添加涉及到以下文件:

  dede/cata日志_add.php

  dede/cata日志_edit.php

  dede/templets/cata日志_add.htm

  dede/templets/cata日志_edit.htm

  include/taglib/channel.lib.php

  此升级修改办法,在V5.7,V5.7sp1 测试通过,其他版本未测试,原理基本相同,请大家自行测试是否可行。

  首先给 栏目表(`dede_arctype`)增加一个字段typeimg

alter table `dede_arctype` add `typeimg` varchar(200) NOT NULL default ;

  修改cata日志_add.php文件

  打开dede/cata日志_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~’,

  查找$in_query = “INSERT INTO `dede_arctype`

  将

(reid,topid,sortrank,typename,typedir,

  替换为:

(reid,topid,sortrank,typename,typedir,typeimg,

  将

(‘$reid’,'$topid’,'$sortrank’,'$typename’,'$typedir’,

  替换为:

(‘$reid’,'$topid’,'$sortrank’,'$typename’,'$typedir’,'$typeimg’,

  保存cata日志_add.php

  下面修改cata日志_edit.php文件

  打开dede/cata日志_edit.php

  查找$upquery = “Update `dede_arctype` set

  在 typedir=’$typedir’, 其下面增加一行:

`typeimg`=’$typeimg’,

  保存cata日志_edit.php

  开始修改栏目添加源码文件

  打开dede/templets/cata日志_add.htm

  在*上面找到这个段

<title>栏目管理</title> <link href=http://www.dede58.com/a/dedejq/”css/base.css” rel=”stylesheet” type=”text/css”>

  替换为:

<title>栏目管理</title> <link href=http://www.dede58.com/a/dedejq/”css/base.css” rel=”stylesheet” type=”text/css”> <script language=”javascript” src=http://www.dede58.com/a/dedejq/”../include/js/dedeajax2.js”></script> <script language=’javascript’ src=http://www.dede58.com/a/dedejq/”js/main.js”></script> <script type=”text/javascript” src=http://www.dede58.com/a/dedejq/”js/calendar/calendar.js”></script>

  列表命名规则:

<tr> <td height="26">列表命名规则:</td> <td> <input name="namerule2" type="text" id="namerule2" value="{typedir}/list_{tid}_{page}.html"/> <img src=http://www.dede58.com/a/dedejq/"images/help.gif" alt="帮助" width="16" height="16" border="0"onClick="ShowHide('helpvar3')"/></td> </tr>

  在标签下面增加一行:

<!--增加栏目缩略图--> <tr> <td width="90">栏目图片:</td> <td width="560"> <table width="100%" border="0" cellspacing="1" cellpadding="1"> <tr> <td height="30"> <input name="typeimg" type="text" id="typeimg"/> <input type="button" value="本地上传"/> <iframe name='uplitpicfra' id='uplitpicfra' src=''></iframe> <span><input name="litpic" type="file" id="litpic" onChange="SeePicNew(this, 'divpicview', 'uplitpicfra', 165, 'archives_add.php');" size="1"/></span> <input type="button" name="Submit2" value="选择图片"onClick="SelectImage('form1.typeimg','small');"/> <input type="button" name="Submit2" value="裁剪"onClick="imageCut('typeimg');"/> <input type='checkbox'name='ddisremote' value='1' id='ddisremote'/>远程<br />(栏目源码里用{dede:field.typeimg /}调用 </td> </tr> </table> </td> <td width="150" align="center"> <div id='divpicview'></div> </td> </tr> <!--增加栏目缩略图-->

  保存cata日志_add.htm

  开始修改栏目编辑源码文件

  打开dede/templets/cata日志_edit.htm

#p#分页标题#e#

  在*上面找到这个段

<title>栏目管理</title> <link href=http://www.dede58.com/a/dedejq/”css/base.css” rel=”stylesheet” type=”text/css”>

  替换为:

<title>栏目管理</title> <link href=http://www.dede58.com/a/dedejq/”css/base.css” rel=”stylesheet” type=”text/css”> <script language=”javascript” src=http://www.dede58.com/a/dedejq/”../include/js/dedeajax2.js”></script> <script language=”javascript” src=http://www.dede58.com/a/dedejq/”js/main.js”></script> <script type=”text/javascript” src=http://www.dede58.com/a/dedejq/”js/calendar/calendar.js”></script>

  查找

<tr> <td height="26">列表命名规则:</td> <td> <input name="namerule2" type="text" id="namerule2" value=http://www.dede58.com/a/dedejq/"<?php echo $myrow['namerule2']?>" size="40"/> <img src=http://www.dede58.com/a/dedejq/"images/help.gif" alt="帮助" width="16" height="16" border="0"onClick="ShowHide('helpvar3')"/></td> </tr>

  在其下面增加一行:

<!--增加栏目缩略图--> <tr> <td width="90" height="81">栏目图片:</td></td> <td width="500"> <input name="typeimg" type="text" id="typeimg"value=http://www.dede58.com/a/dedejq/"<?php echo $myrow['typeimg']?>"><input type="button" name="Submit" value="浏览..."onClick="SelectImage('form1.typeimg','');"> <input type="button" name="Submit2" value="裁剪"onClick="imageCut('typeimg');"/> <input type='checkbox'name='ddisremote' value='1'> 远程<br />(栏目源码里用{dede:field.typeimg /}调用) </td> <td align="center"> <img src=http://www.dede58.com/a/dedejq/"<?php if($myrow['typeimg']!="") echo $myrow['typeimg']; else echo "images/pview.gif";?>" width="150" height="100" id="picview" name="picview"> </td> </tr> <!--增加栏目缩略图-->

  保存cata日志_edit.htm

  至此已经修改完成!

  栏目图片的添加或修改图片时在 (栏目管理>高级选项)里面就会自动出现栏目图片添加的选择,点击选择图片,弹出窗口内选择浏览上传就OK

  注意:前台栏目标签调用的时候,还需要改一个文件,才能实现栏目图片显示,否则只能通过sql语句才能显示图片。

  打开:include/taglib/channel.lib.php

  找到

if($type=='top') { $sql = "Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description From `dede_arctype` where reid=0 And ishidden<>1 order by sortrank asc limit 0,$row"; } else if($type=="son") { //if($_sys_globals['typeid']>0) $typeid = $_sys_globals['typeid']; if($typeid==0) { return ''; } $sql = "Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description From `dede_arctype` where reid='$typeid' And ishidden<>1 order by sortrank asc limit 0,$row"; } else if($type=="self") { if($reid==0) { return ''; } $sql = "Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description From `dede_arctype` where reid='$reid' And ishidden<>1 order by sortrank asc limit 0,$row"; }

  替换成下面的:

if($type=='top') { $sql = "Select id,typename,typeimg,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description From `dede_arctype` where reid=0 And ishidden<>1 order by sortrank asc limit 0,$row"; } else if($type=="son") { //if($_sys_globals['typeid']>0) $typeid = $_sys_globals['typeid']; if($typeid==0) { return ''; } $sql = "Select id,typename,typeimg,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description From `dede_arctype` where reid='$typeid' And ishidden<>1 order by sortrank asc limit 0,$row"; } else if($type=="self") { if($reid==0) { return ''; } $sql = "Select id,typename,typeimg,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description From `dede_arctype` where reid='$reid' And ishidden<>1 order by sortrank asc limit 0,$row"; }

  调用办法:

<img src=http://www.dede58.com/a/dedejq/”[field:typeimg /]” />

 如果想同时在新闻内容详细页调用栏目图片打开,修改\include\arc.archives.class.php

  查找

if($this->ChannelUnit->ChannelInfos['issystem']!=-1) #p#分页标题#e#

  将

$query = “Select arc.*,tp.reid,tp.typedir,ch.addtable from `dede_archives` arc left join dede_arctype tp on tp.id=arc.typeid left join dede_channeltype as ch on arc.channel = ch.id where arc.id=’$aid’ “; $this->Fields = $this->dsql->GetOne($query);

  替换为: 

$query = “Select arc.*,tp.reid,tp.typedir,tp.typeimg,ch.addtable from `dede_archives` arc left join dede_arctype tp on tp.id=arc.typeid left join dede_channeltype as ch on arc.channel = ch.id where arc.id=’$aid’ “; $this->Fields = $this->dsql->GetOne($query);

  保存文件即可。

本文章网址:http://www.ppssdd.com/code/14543.html。转载请保留出处,谢谢合作!

DedeCms 栏目增加缩略图功能的方法

DedeCms 栏目增加缩略图功能的方法

此功能添加涉及到以下文件:

  dede/catalog_add.PHP

  dede/catalog_edit.PHP

  dede/templets/catalog_add.htm

  dede/templets/catalog_edit.htm

  include/taglib/channel.lib.PHP

  此升级修改方法,在v5.7,v5.7sp1 测试通过,其他版本未测试,原理基本相同,请大家自行测试是否可行。

  首先给 栏目表(`dede_arctype`)增加一个字段typeimg

alter table `dede_arctype` add `typeimg` varchar(200) NOT NULL default ;


  修改catalog_add.PHP文件

  打开dede/catalog_add.PHP

  查找$queryTemplate = “insert into `dede_arctype`

  将

(reid,topid,sortrank,typename,typedir,


  替换为:

(reid,typeimg,

  将

(‘~reid~’,'~topid~’,'~rank~’,'~typename~’,'~typedir~’,

  替换为:

(‘~reid~’,'~typeimg~’,

  查找$in_query = “INSERT INTO `dede_arctype`

  将

(reid,

  替换为:

(reid,

  将

(‘$reid’,'$topid’,'$sortrank’,'$typename’,'$typedir’,

  替换为:

(‘$reid’,'$typeimg’,

  保存catalog_add.PHP

  下面修改catalog_edit.PHP文件

  打开dede/catalog_edit.PHP

  查找$upquery = “Update `dede_arctype` set

  在 typedir=’$typedir’,其下面增加一行:

`typeimg`=’$typeimg’,

  保存catalog_edit.PHP

  开始修改栏目添加模板文件

  打开dede/templets/catalog_add.htm

  在最上面找到这个段

栏目管理


  替换为:

栏目管理


  列表命名规则:


  在标签下面增加一行:

图片: 远程
(栏目模板里用{dede:field.typeimg /}调用

DedeCms 给栏目增加缩略图(5.5/5.6通用)

DedeCms 给栏目增加缩略图(5.5/5.6通用)

各位站长朋友,大家好,今天我们来学习一下如何给Dedecms 给栏目增加缩略图,本文转自官方论坛,希望访问学院的朋友给一个出处,本方法适用于Dedecms5.5/5.6。

首先。新加字段 typeimg
后台执行sql:

alter table `dede_arctype` add `typeimg` char(100) NOT NULL default '''';

涉及到文件:
dede/catalog_add.PHP
dede/catalog_edit.PHP
dede/templets/catalog_add.htm
dede/templets/catalog_edit.htm

打开文件夹templets这个目录,在里面新建一个文件夹typeimg,用于独立存放栏目缩略图

打开dede/catalog_add.PHP
查找$queryTemplate = insert into `dede_arctype`
将:

(reid,topid,sortrank,typename,typedir,

替换为:

(reid,typeimg,

再将:

(''~reid~'',''~topid~'',''~rank~'',''~typename~'',''~typedir~'',

替换为:

(''~reid~'',''~typeimg~'',

打开dede/catalog_edit.PHP
查找

$upquery = Update `dede_arctype` set

在其下边增加一行:

`typeimg`=''$typeimg'',

打开dede/templets/catalog_add.htm(小编友情提示:这里的dede为后台目录,一般我们都进行了修改
查找

<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>
<td height=65>栏目图片:</td>
<td>
<input name=typeimg type=text style=width:250px id=typeimg class=alltxt value= />
<input type=button name=set9 value=浏览... class=coolbg np style=width:60px onClick=SelectTemplets(''form1.typeimg&activepath=%2Ftemplets%2Ftypeimg&img=yes''); />
(栏目模板里用{dede:field.typeimg /}调用)
</td>
</tr>

打开dede/templets/catalog_edit.htm
查找

<tr>
<td height=26>列表命名规则:</td>
<td> <input name=namerule2 type=text id=namerule2 value=<?PHP echo $myrow[''namerule2'']?> size=40 class=iptxt />
<img src=img/help.gif alt=帮助 width=16 height=16 border=0 style=cursor:pointer onClick=ShowHide(''helpvar3'')/></td>
</tr>

在其下边增加内容:

<tr>
<td height=65>栏目图片:</td>
<td>
<input name=typeimg type=text style=width:250px id=typeimg class=alltxt value=<?PHP echo $myrow[''typeimg'']?> />
<input type=button name=set9 value=浏览... class=coolbg np style=width:60px onClick=Selectimages(''form1.typeimg&activepath=%2Ftemplets%2Ftypeimg&img=yes''); />

(栏目模板里用{dede:field.typeimg /}调用)
</td>
</tr>
完成!

总结

以上是小编为你收集整理的DedeCms 给栏目增加缩略图(5.5/5.6通用)全部内容。

如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。

dedecms织梦怎样根据不同栏目显示不同的默认缩略图

dedecms织梦怎样根据不同栏目显示不同的默认缩略图

用过Dedecms的都知道,当显示文章的时候,如果该文章没有添加缩略图,那么会显示系统默认的缩略图 /images/defaultpic.gif (Dedecms无缩略图)

如果我们需要根据不同栏目显示不同的无缩略图的话。就需要对标签函数做出修改。

一般情况下显示分为动态和静态。(文件不同)

一、动态:

动态一般是在plus文件夹下显示。对应的文件是/plus/list.PHP和/include/arc.listview.class.PHP

动态页里面的{dede:list 标签就要修改arc.listview.class.PHP文件,找到defaultpic.gif:

在function GetArcList函数里:

TypeID==121){ $row['litpic'] = $GLOBALS['cfg_cmspath'].'/images/default_course.gif'; }else if($this->TypeID==48 || $this->TypeID==51 || $this->TypeID==52){ $row['litpic'] = $GLOBALS['cfg_cmspath'].'/images/default_teacher.gif'; }else if($this->TypeID==122){ $row['litpic'] = $GLOBALS['cfg_cmspath'].'/images/default_resume.gif'; }else{ $row['litpic'] = $GLOBALS['cfg_cmspath'].'/images/defaultpic.gif'; } }

二、静态:

找到/include/arc.archives.class.PHP

在function ParaddTable函数里:

Fields['litpic'] == '-' || $this->Fields['litpic'] == ''){ if($this->Fields['channel']==6){ $this->Fields['litpic'] = $GLOBALS['cfg_cmspath'].'/images/default_course.gif'; }else{ if($this->Fields['typeid']==48 || $this->Fields['typeid']==51 || $this->Fields['typeid']==52){ $this->Fields['litpic'] = $GLOBALS['cfg_cmspath'].'/images/default_teacher.gif'; }else{ $this->Fields['litpic'] = $GLOBALS['cfg_cmspath'].'/images/defaultpic.gif'; } } }

今天的关于dedecms织梦程序给栏目增加缩略图办法织梦如何给栏目增加缩略图的分享已经结束,谢谢您的关注,如果想了解更多关于DedeCms 栏目增加缩略图功能的办法、DedeCms 栏目增加缩略图功能的方法、DedeCms 给栏目增加缩略图(5.5/5.6通用)、dedecms织梦怎样根据不同栏目显示不同的默认缩略图的相关知识,请在本站进行查询。

本文标签: