設為首頁收藏本站

 取回密碼
 註冊
搜尋
熱搜: Redump discuz
檢視: 646|回覆: 0

【轉貼】 Discuz! X3.4標題字數突破80的解決方法

[複製連結]
發表於 2021年4月6日 16:05:13 | 顯示全部內容 |閱讀模式
修改論壇標題字數限制,下面五個部分需要修改:

一、資料庫
二、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" 要修改
 <!--{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} onkeyup="strLenCalc(this, 'checklen', 80);" style="width: 25em" tabindex="1" /></span> 
                        <!--{else}--> 
                                <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> 
                        <!--{/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}-->



      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 個字元修改標題長度',
作者文章推薦
懶得打字嗎?讓本助手協助你 【使用進階編輯器請點選右方進階模式】
您需要登入後才可以回覆 登入 | 註冊

本版積分規則

手機版|Archiver|漁家小舖

GMT+8, 2024年4月19日 15:41 , Processed in 0.460888 second(s), 16 queries , Gzip On, Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回覆 返回頂端 返回清單