discuz默认标题只能输入80个字符,很多时候经常不够用,下面魔趣建站提供修改方法,修改为180字符长度!
1,首先修改数据库,经过我的经验,修改为180字符最为合适,当然,你可以参照你自己的实用需求,需要修改/config/config_global.php里面的
$_config['admincp']['runquery'] = '1';
开启SQL权限,运行下面的sql语句:
ALTER TABLE `pre_forum_post` CHANGE `subject` `subject` VARCHAR(180) NOT NULL;
ALTER TABLE `pre_forum_rsscache` CHANGE `subject` `subject` char(180) NOT NULL;
ALTER TABLE `pre_forum_thread` CHANGE `subject` `subject` char(180) NOT NULL;
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) > 180) {
s = '您的标题超过 180 个字符的限制';
theform.subject.focus();
}
3,接着修改JS验证字符数:修改文件static/js/forum_post.js中的(可以Ctrl+F搜索字段)
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) > 180) { showError('您的标题超过 180 个字符的限制'); return false; }将里边的80字符改为180字符
4,修改模板中写死的字符限制数: 找到文件\template\default\forum\post_editor_extra.htm中的80字符限制,修改为180(可以Ctrl+F搜索字段):
<!--{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">180</strong> {lang comment_message2}</span>
将里边的80字符改为180字符,如上
5,找到文件\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">180</strong> {lang comment_message2}</span>将里边的80字符改为180字符,如上
7,修改函数验证提示:找到文件source/function/function_post.php
if(dstrlen($subject) > 80) {return 'post_subject_toolong';}修改为:
if(dstrlen($subject) > 180) {return 'post_subject_toolong';
}8,找到语言包提示文字,打开 source/language/lang_messege.php
'post_subject_toolong' => '抱歉,您的标题超过 120 个字符修改标题长度',
更新缓存,好了,到现在你的论坛发帖标题就修改为180个字符了,完全够用了!
历史资源提醒--必看
该页面资源/教程来自原魔趣吧历史资源转移,因发布历史久远,部分资源/教程可能已失效或无法在最新版程序中安装使用!DZ资源建议在Discuz3.4及以下版本使用,PHP版本建议5.6。资源仅提供做代码研究学习使用!
因改版,部分贴内链接将无法正常跳转,如链接失效或未正常跳转,请利用站内搜索功能搜索资源名称获取对应资源!