硬汉嵌入式论坛

 找回密码
 立即注册
查看: 2119|回复: 3
收起左侧

[服务器设置] DZ论坛,修改标题长度限制。缺省是80字符,太短了

[复制链接]

747

主题

1049

回帖

3295

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
3295
发表于 2017-12-21 19:04:28 | 显示全部楼层 |阅读模式
以标题长度为 120 个字符为例

修改JS验证字符数:
1、找到文件static/js/forum_post.js
} else if(mb_strlen(theform.subject.value) > 80) {
showError('您的标题超过 80 个字符的限制');
return false;
}
修改为:
} else if(mb_strlen(theform.subject.value) > 120) {
showError('您的标题超过 120 个字符的限制');
return false;
}


2、找到文件sitatic/js/forum.js
if(theform.message.value == '' && theform.subject.value == '') {
                 s = '抱歉,您尚未输入标题或内容';
                 theform.message.focus();
         } else if(mb_strlen(theform.subject.value) > 80) {
                 s = '您的标题超过 80 个字符的限制';
                 theform.subject.focus();
         }
修改为:
if(theform.message.value == '' && theform.subject.value == '') {
                 s = '抱歉,您尚未输入标题或内容';
                 theform.message.focus();
         } else if(mb_strlen(theform.subject.value) > 120) {
                 s = '您的标题超过 120 个字符的限制';
                 theform.subject.focus();
         }

3、修改模板中写死的字符限制数:
1)找到文件\template\default\forum\post_editor_extra.htm

< !--{if $_G[gp_action] != 'reply'}-->
< span><input type="text" name="subject" id="subject" class="px" value="$postinfo[subject]" {if $_G[gp_action] == 'newthread'}onblur="if($('tags')){relatekw('-1','-1'{if $_G['group']['allowposttag']},function(){extraCheck(4)}{/if});doane();}"{/if} style="width: 25em" tabindex="1" /></span>
< !--{else}-->
< span id="subjecthide" class="z">RE: $thread[subject] [<a href="javascript:;">{lang modify}</a>]</span>
< span id="subjectbox" style="display:none"><input type="text" name="subject" id="subject" class="px" value="" style="width: 25em" /></span>
< !--{/if}-->
< span id="subjectchk"{if $_G[gp_action] == 'reply'} style="display:none"{/if}>{lang comment_message1} <strong id="checklen">80</strong> {lang comment_message2}</span>
修改为下面代码:
<!--{if $_G[gp_action] != 'reply'}-->
< span><input type="text" name="subject" id="subject" class="px" value="$postinfo[subject]" {if $_G[gp_action] == 'newthread'}onblur="if($('tags')){relatekw('-1','-1'{if $_G['group']['allowposttag']},function(){extraCheck(4)}{/if});doane();}"{/if} style="width: 25em" tabindex="1" /></span>
< !--{else}-->
< span id="subjecthide" class="z">RE: $thread[subject] [<a href="javascript:;">{lang modify}</a>]</span>
< span id="subjectbox" style="display:none"><input type="text" name="subject" id="subject" class="px" value="" style="width: 25em" /></span>
< !--{/if}-->
< span id="subjectchk"{if $_G[gp_action] == 'reply'} style="display:none"{/if}>{lang comment_message1} <strong id="checklen">120</strong> {lang comment_message2}</span>

2)找到文件\template\default\forum\forumdisplay_fastpost.htm
< input type="text" id="subject" name="subject" class="px" value="" tabindex="11" style="width: 25em" />
< span>{lang comment_message1} <strong id="checklen">80</strong> {lang comment_message2}</span>
修改为:
<input type="text" id="subject" name="subject" class="px" value="" tabindex="11" style="width: 25em" />
< span>{lang comment_message1} <strong id="checklen">120</strong> {lang comment_message2}</span>

4,修改函数验证提示:找到文件source/function/function_post.php
if(dstrlen($subject) > 80) {
return 'post_subject_toolong';
}
修改为:
if(dstrlen($subject) > 120) {
return 'post_subject_toolong';
}

5、找到语言包提示文字,打开 source/language/lang_messege.php  
   'post_subject_toolong' => '抱歉,您的标题超过 120 个字符修改标题长度',
OK,你再发表帖子标题就可以是120个字符数了!!!


数据库及要修改的字段:
ALTER TABLE 表名 modify subject varchar(XXX)
pre_forum_post 表 subject 字段
pre_forum_thread 表 subject 字段
forum_collection 表 lastsubject 字段 forum_fourmrecommend 表 subject 字段 forum_rsscache 表 subject 字段
X3.4版本还有个表要改
pre_forum_rsscache   subject 字段



(修改数据库,请先备份数据库)


回复

使用道具 举报

747

主题

1049

回帖

3295

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
3295
 楼主| 发表于 2017-12-21 22:37:51 | 显示全部楼层
回复

使用道具 举报

747

主题

1049

回帖

3295

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
3295
 楼主| 发表于 2019-10-22 12:12:01 | 显示全部楼层
2019-10-22 升级DZ程序,重新改为120长度限制了,缺省是80
回复

使用道具 举报

747

主题

1049

回帖

3295

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
3295
 楼主| 发表于 2021-11-4 10:04:00 | 显示全部楼层
2021-11-04 升级DZ程序到X3.4 20211022,重新修改长度限制为120个
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|Archiver|手机版|硬汉嵌入式论坛

GMT+8, 2024-5-6 20:20 , Processed in 0.250135 second(s), 24 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表