dedecms:为栏目增加缩略图的最终方法

2025-10-28 21:16:45

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

dede/catalog_add.php

dede/catalog_edit.php

dede/templets/catalog_add.htm

dede/templets/catalog_edit.htm

dedecms:为栏目增加缩略图的最终方法

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

3、新加字段 typeimg

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

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

dedecms:为栏目增加缩略图的最终方法

4、打开dede/catalog_add.php

查找(ctrl+f):

$queryTemplate = "insert into `dede_arctype`

1、将:

(reid,topid,sortrank,typename,typedir,

替换为:

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

2、将:

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

替换为:

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

dedecms:为栏目增加缩略图的最终方法

5、打开dede/catalog_edit.php

查找(ctrl+f):

$upquery = "Update `dede_arctype` set

在其下面新加一行:

`typeimg`='$typeimg',

dedecms:为栏目增加缩略图的最终方法

6、打开dede/templets/catalog_add.htm

(因百度有特殊字符屏蔽,所以只能用下图,copy的同学自己打字吧)

dedecms:为栏目增加缩略图的最终方法

7、打开dede/templets/catalog_edit.htm

(因百度有特殊字符屏蔽,所以只能用下图,copy的同学自己打字吧)

dedecms:为栏目增加缩略图的最终方法

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

1、打开\include\arc.archives.class.php

查找(ctrl+f)下面代码:

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);

替换为:

$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);

2、这样可以直接在文章内容也也调用栏目缩略图了。

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢