织梦dedecms栏目添加自定义字段

本文详细介绍了如何在织梦内容管理系统(DedeCMS)中为栏目添加自定义字段,以增强网站内容的灵活性和个性化设置。通过自定义字段,可以为不同栏目定制特定的信息展示,提升用户体验。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

第一步:执行SQL命令为数据库的栏目表结构添加一个字段

 alter table `dede_arctype` add `typeen` varchar(200) NOT NULL default ;
1
或者去数据库dede_arctype添加一个表结构typeen varchar为200的字段

第二步:修改涉及到文件:

dede/catalog_add.php

dede/catalog_edit.php

dede/templets/catalog_add.htm

dede/templets/catalog_edit.htm

include/taglib/channel.lib.php
1
2
3
4
5
6
7
8
9
1、修改dede/catalog_add.php文件 
打开查找

$queryTemplate = “insert into `dede_arctype`   
1
将

(reid,topid,sortrank,typename,typedir,
1
替换为:

(reid,topid,sortrank,typename,typedir,typeen,
1
将


 (‘~reid~’,'~topid~’,'~rank~’,'~typename~’,'~typedir~’,
1
2
替换为:

 (‘~reid~’,'~topid~’,'~rank~’,'~typename~’,'~typedir~’,'~typeen~’,
1
查找

 $in_query = “INSERT INTO `dede_arctype`
1
将

 (reid,topid,sortrank,typename,typedir,
1
替换为:

 (reid,topid,sortrank,typename,typedir,typeen,
1
将

  (‘$reid’,'$topid’,'$sortrank’,'$typename’,'$typedir’,
1
替换为:

(‘$reid’,'$topid’,'$sortrank’,'$typename’,'$typedir’,'$typeen’,
1
保存catalog_add.php。

2、修改dede/catalog_edit.php文件 
查找

$upquery = “Update `dede_arctype` set
1
在 typedir=’$typedir’, 其下面增加一行:

`typeen`=’$typeen’,
1
保存catalog_edit.php。

2、修改dede/templets/catalog_add.htm文件

<tr>
<td class='bline' height="26" style="padding-left:10px;"><font color='red'>栏目名称:</font></td>
<td class='bline'><input name="typename" type="text" id="typename" size="30" class="iptxt" /></td>
</tr>
1
2
3
4
在这段下面添加

<tr>
<td class='bline' height="26" style="padding-left:10px;"><font color='red'>英文名称:</font></td>
<td class='bline'><input name="typeen" type="text" id="typeen" size="30" class="iptxt" /></td>
</tr>
1
2
3
4
前台调用:[field:typeen/]

第四步:文章内容页调用 
如果想同时在文章内容页调用栏目图片打开,修改\include\arc.archives.class.php

查找

if($this->ChannelUnit->ChannelInfos['issystem']!=-1)
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);
1
2
3
4
5
6
7
8
9
10
替换为:

$query = “Select arc.*,tp.reid,tp.typedir,tp.typeen,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);

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值