鲸云网络 发表于 2020-1-5 20:38:00

Discuz!X3.2 x3.3 x3.4 帖子标题限制80个字符的修改方法

以修改为200个字符为例:第一步、执行SQL语句SQL代码:
ALTER TABLE `pre_forum_post` CHANGE `subject` `subject` VARCHAR(200) NOT NULL;
ALTER TABLE `pre_forum_rsscache` CHANGE `subject` `subject` char(200) NOT NULL;
ALTER TABLE `pre_forum_thread` CHANGE `subject` `subject` char(200) NOT NULL;
第二步、修改JS文件打开 /static/js/forum_post.js 文件
查找
else if(mb_strlen(theform.subject.value) > 80) {
      s = ‘您的标题超过 80 个字符的限制’;
      theform.subject.focus();
}
修改为else if(mb_strlen(theform.subject.value) > 200) {
      s = ‘您的标题超过 200 个字符的限制’;
      theform.subject.focus();
}
打开 /static/js/forum.js 文件
查找
else if(mb_strlen(theform.subject.value) > 80) {
      showError(‘您的标题超过 80 个字符的限制’);
      return false;
    }
修改为else if(mb_strlen(theform.subject.value) > 200) {
      showError(‘您的标题超过 200 个字符的限制’);
      return false;
    }
第三步、修改模板文件打开 /template/default/forum/post_editor_extra.htm 文件查找
<span><input type=”text” name=”subject” id=”subject” class=”px” value=”$postinfo” {if $_GET == ‘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 $_GET == ‘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>
修改为
<span><input type=”text” name=”subject” id=”subject” class=”px” value=”$postinfo” {if $_GET == ‘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 $_GET == ‘reply’} style=”display:none”{/if}>{lang comment_message1} <strong id=”checklen”>200</strong> {lang comment_message2}</span>
            <script type=”text/javascript”>strLenCalc($(‘subject’), ‘checklen’, 200)</script>
打开 /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”>200</strong> {lang comment_message2}</span>
第四步、修改函数打开 /source/function/function_post.php 文件找到:
if(dstrlen($subject) > 80) {
return ‘post_subject_toolong’;
}
修改为:
if(dstrlen($subject) > 200) {
return ‘post_subject_toolong’;
}
第五步、语言包修改
打开 /source/language/lang_messege.php 文件找到
‘post_subject_toolong’ => ‘抱歉,您的标题超过 80 个字符修改标题长度’,
修改为
‘post_subject_toolong’ => ‘抱歉,您的标题超过 200 个字符修改标题长度’

页: [1]
查看完整版本: Discuz!X3.2 x3.3 x3.4 帖子标题限制80个字符的修改方法