修改論壇標題字數限制,下面五個部分需要修改:
一、資料庫
二、JS驗證
三、模板限制
四,函數驗證
五,語言包
現以把標題字符限制80修改為120為例子:
一、資料庫修改資料庫標題字段的長度為120字符:執行下面的sql語句:
(注意修改你的表的前綴)
- ALTER TABLE `pre_forum_post` CHANGE `subject` `subject` VARCHAR(120) NOT NULL;
- ALTER TABLE `pre_forum_rsscache` CHANGE `subject` `subject` char(120) NOT NULL;
- ALTER TABLE `pre_forum_thread` CHANGE `subject` `subject` char(120) NOT NULL;
或是把pre_forum_post、pre_forum_rsscache、pre_forum_thread的subject長度改成120
底下的全部都是需要把80改成120的文件
二、JS驗證:
1、找到 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;
- }
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();
- }
三、模板:
1、找到文件\template\default\forum\post_editor_extra.htm 有5個 "80" 要修改
-
- <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} onkeyup="strLenCalc(this, 'checklen', 80);" style="width: 25em" tabindex="1" /></span>
-
- <span id="subjecthide" class="z">RE: $thread[subject] [<a href="javascript:;" onclick="display('subjecthide');display('subjectbox');$('subject').value='RE: {echo dhtmlspecialchars(str_replace('\'', '\\\'', $thread[subject]))}';display('subjectchk');strLenCalc($('subject'), 'checklen', 80);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>
-
- <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>
-
2、找到文件\template\default\forum\forumdisplay_fastpost.htm
- <input type="text" id="subject" name="subject" class="px" value="" onkeyup="strLenCalc(this, 'checklen', 80);" tabindex="11" style="width: 25em" />
- <span>{lang comment_message1} <strong id="checklen">80</strong> {lang comment_message2}</span>
四,修改函數驗證提示:
找到文件source/function/function_post.php
- if(dstrlen($subject) > 80) {
- return 'post_subject_toolong';
- }
五、找到語言包提示文字,打開 source/language/lang_messege.php
- 'post_subject_toolong' => '抱歉,您的標題超過 80 個字元修改標題長度',