DISCUZ! X3.4论坛标题字数(80个字符)限制长度
可能很多使用DISCUZ! X3.4平台朋友,发现一个问题就是发帖的标题被限制为80个字符。且也没办法修改长度,今天这里给大家介绍几个方法,希望对大家有帮助。修改JS验证字符数文件
首先使用ftp工具 进入后台文件管理。
找到文件static/js/forum_post.js
下载下来,打开编辑
找到:77行
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;
}修改为:
然后找到文件static/js/forum.js
下载下来,打开编辑
找到:239行
if(theform.message.value == '' || theform.subject.value == '') {
s = '抱歉,您尚未输入标题或内容';
theform.message.focus();
} else if(mb_strlen(theform.subject.value) > 120) {
s = '您的标题超过 120 个字符的限制';
theform.subject.focus();
}修改为:
由于Discuz! 后台默认情况下禁止 SQL 语句直接执行,只能使用常用 SQL 当中的内容。
如果您想自己随意书写 SQL 升级语句,需要将 config/config_global.php 当中的 $_config 设置修改为 1。
(因为我们这里需要执行SQL语句所以需要改,或者直接在PHPmyadmin 里面执行SQL语句即可)
这里我是修改了config_global.php文件。
首先,进入discuz的后台->站长->数据库->升级
数据库修改,修改数据库标题字段的长度为120字符:运行下面的sql语句:(注意修改你的表的前缀)
ALTER TABLE `pre_forum_post` CHANGE `subject` `subject` VARCHAR(120) NOT NULL;
点击:提交 ,成功如图所示
然后继续使用ftp工具找到,找到文件\template\default\forum\post_editor_extra.htm
下载,编辑
找到:(把80 改成 120)
<!--{if $_GET != 'reply'}-->
<span><input type="text" name="subject" id="subject" class="px" value="$postinfo" onkeyup="strLenCalc(this, 'checklen', 80);" style="width: 25em" tabindex="1" /></span>
<!--{else}-->
<span id="subjecthide" class="z">RE: $thread [<a href="javascript:;" onclick="display('subjecthide');display('subjectbox');return false;">{lang modify}</a>]</span>
<span id="subjectbox" style="display:none"><input type="text" name="subject" id="subject" class="px" value="" onkeyup="strLenCalc(this, 'checklen', 80);" 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>
<!--{/if}-->修改为:
继续找到文件\template\default\forum\forumdisplay_fastpost.htm
下载,编辑
<input type="text" id="subject" name="subject" class="px" value="" onkeyup="strLenCalc(this, 'checklen', 120);" tabindex="11" style="width: 25em" />
<span>{lang comment_message1} <strong id="checklen">120</strong> {lang comment_message2}</span>修改为:
修改函数验证文件
继续使用ftp工具 。找到文件/source/function/function_post.php
下载编辑。
找到:372行
if(dstrlen($subject) > 80) {
return 'post_subject_toolong';
}修改为:
if(dstrlen($subject) > 120) {
return 'post_subject_toolong';
}修改语言包文件
找到: source/language/lang_messege.php
下载编辑
找到:1006行
'post_subject_toolong' => '抱歉,您的标题超过 80 个字符修改标题长度',修改:
'post_subject_toolong' => '抱歉,您的标题超过 120 个字符修改标题长度',最后进入discuz的后台->工具->更新缓存ok 感谢分享!! 楼主,不论什么情况你一定要hold住!hold住就是胜利! 啥也不说了,楼主就是给力! 666666666666666
看了LZ的帖子,我只想说一句很好很强大! 膜拜神贴,后面的请保持队形~ 哥顶的不是帖子,是寂寞! 果断回帖,如果沉了就是我弄沉的很有成就感 果断回帖,如果沉了就是我弄沉的很有成就感