armfly 发表于 2017-12-21 19:04:28

DZ论坛,修改标题长度限制。缺省是80字符,太短了

以标题长度为 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 != 'reply'}-->
< span><input type="text" name="subject" id="subject" class="px" value="$postinfo" {if $_G == '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 [<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 == 'reply'} style="display:none"{/if}>{lang comment_message1} <strong id="checklen">80</strong> {lang comment_message2}</span>
修改为下面代码:
<!--{if $_G != 'reply'}-->
< span><input type="text" name="subject" id="subject" class="px" value="$postinfo" {if $_G == '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 [<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 == '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 字段



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


armfly 发表于 2017-12-21 22:37:51

:):(:funk::call:

armfly 发表于 2019-10-22 12:12:01

2019-10-22 升级DZ程序,重新改为120长度限制了,缺省是80

armfly 发表于 2021-11-4 10:04:00

2021-11-04 升级DZ程序到X3.4 20211022,重新修改长度限制为120个
页: [1]
查看完整版本: DZ论坛,修改标题长度限制。缺省是80字符,太短了