|
【原创】Discuz! X3.4论坛发帖标题长度无法超过80个字符限制
1.修改JS验证字符数文件
修改文件.../static/js/forum_post.js
找到:
if(($('postsubmit').name != 'replysubmit' && !($('postsubmit').name == 'editsubmit' && !isfirstpost) && theform.subject.value == "") || !sortid && !special && trim(message) == "") { showError('抱歉,您尚未输入标题或内容'); return false; } else if(mb_strlen(theform.subject.value) > 80) { showError('您的标题超过 80 个字符的限制'); return false; }
修改为:
if(($('postsubmit').name != 'replysubmit' && !($('postsubmit').name == 'editsubmit' && !isfirstpost) && theform.subject.value == "") || !sortid && !special && trim(message) == "") { showError('抱歉,您尚未输入标题或内容'); return false; } else if(mb_strlen(theform.subject.value) > 120) { showError('您的标题超过 120 个字符的限制'); return false; }
2.修改数据库字段大小
use bbsdb
alter table pre_forum_post modify subject varchar(120) DEFAULT NULL COMMENT 'old-varchar(80)';
alter table pre_forum_rsscache modify subject varchar(120) DEFAULT NULL COMMENT 'old-varchar(80)';
alter table pre_forum_thread modify subject char(120) DEFAULT NULL COMMENT 'old-char(80)';
commit;
exit;
3.修改模板中写死的字符限制数
修改文件.../template/default/forum/post_editor_extra.htm
找到:(把80 改成 120)
<!--{if $_GET[action] != 'reply'}-->
<span><input type="text" name="subject" id="subject" class="px" value="$postinfo[subject]" {if $_GET[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 $_GET[action] == 'reply'} style="display:none"{/if}>{lang comment_message1} <strong id="checklen">80</strong> {lang comment_message2}</span>
<script type="text/javascript">strLenCalc($('subject'), 'checklen', 80)</script>
<!--{/if}-->
修改为:
<!--{if $_GET[action] != 'reply'}--><span><input type="text" name="subject" id="subject" class="px" value="$postinfo[subject]" {if $_GET[action] == 'newthread'}onblur="if($('tags')){relatekw('-1','-1'{if $_G['group']['allowposttag']},function(){extraCheck(4)}{/if});doane();}"{/if}#ff0000">120);" style="width: 25em" tabindex="1" /></span><!--{else}--><span id="subjecthide" class="z">RE: $thread[subject] [<a href="javascript:;"#ff0000">120);return false;">{lang modify}</a>]</span><span id="subjectbox" style="display:none"><input type="text" name="subject" id="subject" class="px" value=""FONT-WEIGHT: bold; COLOR: #0000ff">120);" style="width: 25em" /></span><!--{/if}--> <span id="subjectchk"{if $_GET[action] == 'reply'} style="display:none"{/if}>{lang comment_message1} <strong id="checklen">120</strong> {lang comment_message2}</span><script type="text/javascript">strLenCalc($('subject'), 'checklen', 120)</script><!--{/if}-->
继续找到文件:.../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' => '抱歉,您的标题超过 80 个字符修改标题长度'
修改:
'post_subject_toolong' => '抱歉,您的标题超过 120个字符修改标题长度'
6.更新论坛缓存
discuz的后台->工具->更新缓存
更新缓存后,完美~
|