久久久久av_欧美日韩一区二区在线_国产精品三区四区_日韩中字在线

返回列表 發帖
查看: 5031|回復: 0

DISCUZ! X3.4論壇標題字數(80個字符)限制長度

69

主題

107

回帖

706

積分

自成一派

貢獻
4 點
金幣
154 個
樓主
發表于 2019-7-29 00:11:22 | 只看樓主 |只看大圖 |倒序瀏覽 |閱讀模式
可能很多使用DISCUZ! X3.4平臺朋友,發現一個問題就是發帖的標題被限制為80個字符。且也沒辦法修改長度,今天這里給大家介

紹幾個方法,希望對大家有幫助。

字符最大限制為255,不要修改超過255,不然會失敗!
不管修改什么文件,首先要做的就是備份好要修改的文件,這是一個稱職站長必做的一件事情

摘要:現在修改不像以前那樣更新就可以直接使用了,更新之后還要等待5-10分鐘,這是必須等待的。

心愿:如果此貼對您有用的話麻煩您動一動鼠標給個免費的評分吧!謝謝爸爸們!

第一步:進入后臺文件管理。
找到文件  static/js/forum_post.js  編輯


找到:

  1. <div align="left"><font size="3"><span style="white-space:pre">        </span>if(($('postsubmit').name != 'replysubmit' && !($('postsubmit').name == 'editsubmit' && !isfirstpost) && </font></div><div align="left"><font size="3">
  2. </font></div><div align="left"><font size="3">theform.subject.value == "") || !sortid && !special && trim(message) == "") {</font></div><div align="left"><font size="3"><span style="white-space:pre">                </span>showError('抱歉,您尚未輸入標題或內容');</font></div><div align="left"><font size="3"><span style="white-space:pre">                </span>return false;</font></div><div align="left"><font size="3"><span style="white-space:pre">        </span>} else if(mb_strlen(theform.subject.value) > 80) {</font></div><div align="left"><font size="3"><span style="white-space:pre">                </span>showError('您的標題超過 80 個字符的限制');</font></div><div align="left"><font size="3"><span style="white-space:pre">                </span>return false;</font></div><div align="left"><font size="3"><span style="white-space:pre">        </span>}</font></div>
復制代碼

修改為:

  1. <div align="left"><font size="3"><span style="white-space:pre">        </span>if(($('postsubmit').name != 'replysubmit' && !($('postsubmit').name == 'editsubmit' && !isfirstpost) && </font></div><div align="left"><font size="3">
  2. </font></div><div align="left"><font size="3">theform.subject.value == "") || !sortid && !special && trim(message) == "") {</font></div><div align="left"><font size="3"><span style="white-space:pre">                </span>showError('抱歉,您尚未輸入標題或內容');</font></div><div align="left"><font size="3"><span style="white-space:pre">                </span>return false;</font></div><div align="left"><font size="3"><span style="white-space:pre">        </span>} else if(mb_strlen(theform.subject.value) > 255) {</font></div><div align="left"><font size="3"><span style="white-space:pre">                </span>showError('您的標題超過 255 個字符的限制');</font></div><div align="left"><font size="3"><span style="white-space:pre">                </span>return false;</font></div><div align="left"><font size="3"><span style="white-space:pre">        </span>}</font></div>
復制代碼

然后找到文件  static/js/forum.js   編輯

然后繼續找到:


  1. <div align="left"><font size="3"><span style="white-space:pre">        </span>if(theform.message.value == '' || theform.subject.value == '') {</font></div><div align="left"><font size="3"><span style="white-space:pre">                </span>s = '抱歉,您尚未輸入標題或內容';</font></div><div align="left"><font size="3"><span style="white-space:pre">                </span>theform.message.focus();</font></div><div align="left"><font size="3"><span style="white-space:pre">        </span>} else if(mb_strlen(theform.subject.value) > 80) {</font></div><div align="left"><font size="3"><span style="white-space:pre">                </span>s = '您的標題超過 80 個字符的限制';</font></div><div align="left"><font size="3"><span style="white-space:pre">                </span>theform.subject.focus();</font></div><div align="left"><font size="3"><span style="white-space:pre">        </span>}</font></div>
復制代碼

修改為:

  1. <div align="left"><font size="3"><span style="white-space:pre">        </span>if(theform.message.value == '' || theform.subject.value == '') {</font></div><div align="left"><font size="3"><span style="white-space:pre">                </span>s = '抱歉,您尚未輸入標題或內容';</font></div><div align="left"><font size="3"><span style="white-space:pre">                </span>theform.message.focus();</font></div><div align="left"><font size="3"><span style="white-space:pre">        </span>} else if(mb_strlen(theform.subject.value) > 255) {</font></div><div align="left"><font size="3"><span style="white-space:pre">                </span>s = '您的標題超過 255 個字符的限制';</font></div><div align="left"><font size="3"><span style="white-space:pre">                </span>theform.subject.focus();</font></div><div align="left"><font size="3"><span style="white-space:pre">        </span>}</font></div>
復制代碼

第二步:數據庫修改

進入discuz的后臺->站長->數據庫->升級

由于Discuz! 后臺默認情況下禁止 SQL 語句直接執行,只能使用常用 SQL 當中的內容。

如果您想自己隨意書寫 SQL 升級語句,需要將 config/config_global.php 當中的
  1. $_config['admincp']['runquery'] = '0';
復制代碼

把 0  設置修改為 1


(因為我們這里需要執行SQL語句所以需要改,或者直接在PHPmyadmin 里面執行SQL語句即可)

這里我是修改了  config_global.php  文件。

3
數據庫修改,修改數據庫標題字段的長度為255字符:運行下面的sql語句:(注意修改你的表的前綴)

  1. <div align="left"><font size="3">ALTER TABLE `pre_forum_post` CHANGE `subject` `subject` VARCHAR(255) NOT NULL;</font></div><div align="left"><font size="3">ALTER TABLE `pre_forum_rsscache` CHANGE `subject` `subject` char(255) NOT NULL;</font></div><div align="left"><font size="3">ALTER TABLE `pre_forum_thread` CHANGE `subject` `subject` char(255) NOT NULL;</font></div>
復制代碼

點擊:提交 ,成功如圖所示


第三步:修改模板中寫死的字符限制數

找到文件  \template\default\forum\post_editor_extra.htm  編輯

找到:(把80 改成 255)

  1. <div align="left"><font size="3">
  2. </font></div><div align="left"><font size="3"><span style="white-space:pre">                        </span><!--{if $_GET[action] != 'reply'}--></font></div><div align="left"><font size="3"><span style="white-space:pre">                                </span><span><input type="text" name="subject" id="subject" class="px" value="$postinfo[subject]" onkeyup="strLenCalc(this, 'checklen', 80);" style="width: 25em" tabindex="1" /></span></font></div><div align="left"><font size="3"><span style="white-space:pre">                        </span><!--{else}--></font></div><div align="left"><font size="3"><span style="white-space:pre">                                </span><span id="subjecthide" class="z">RE: $thread[subject] [<a href="javascript:;" onclick="display('subjecthide');display('subjectbox');return false;">{lang modify}</a>]</span></font></div><div align="left"><font size="3"><span style="white-space:pre">                                </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></font></div><div align="left"><font size="3"><span style="white-space:pre">                        </span><!--{/if}--><span style="white-space:pre">                        </span></font></div><div align="left"><font size="3"><span style="white-space:pre">                        </span><span id="subjectchk"{if $_GET[action] == 'reply'} style="display:none"{/if}>{lang comment_message1} <strong id="checklen">80</strong> {lang comment_message2}</span></font></div><div align="left"><font size="3"><span style="white-space:pre">                        </span><script type="text/javascript">strLenCalc($('subject'), 'checklen', 80)</script></font></div>
復制代碼

修改為:

  1. <div align="left"><font size="3"><span style="white-space:pre">                        </span><!--{if $_GET[action] != 'reply'}--></font></div><div align="left"><font size="3"><span style="white-space:pre">                                </span><span><input type="text" name="subject" id="subject" class="px" value="$postinfo[subject]" onkeyup="strLenCalc(this, 'checklen', 255);" style="width: 25em" tabindex="1" /></span></font></div><div align="left"><font size="3"><span style="white-space:pre">                        </span><!--{else}--></font></div><div align="left"><font size="3"><span style="white-space:pre">                                </span><span id="subjecthide" class="z">RE: $thread[subject] [<a href="javascript:;" onclick="display('subjecthide');display('subjectbox');return false;">{lang modify}</a>]</span></font></div><div align="left"><font size="3"><span style="white-space:pre">                                </span><span id="subjectbox" style="display:none"><input type="text" name="subject" id="subject" class="px" value="" onkeyup="strLenCalc(this, 'checklen', 255);" style="width: 25em" /></span></font></div><div align="left"><font size="3"><span style="white-space:pre">                        </span><!--{/if}--><span style="white-space:pre">                        </span></font></div><div align="left"><font size="3"><span style="white-space:pre">                        </span><span id="subjectchk"{if $_GET[action] == 'reply'} style="display:none"{/if}>{lang comment_message1} <strong id="checklen">255</strong> {lang comment_message2}</span></font></div><div align="left"><font size="3"><span style="white-space:pre">                        </span><script type="text/javascript">strLenCalc($('subject'), 'checklen', 255)</script></font></div>
復制代碼

繼續找到文件  \template\default\forum\forumdisplay_fastpost.htm  編輯


找到:

  1. <div align="left"><font size="3"><span style="white-space:pre">                                </span><!--{/if}--></font></div><div align="left"><font size="3"><span style="white-space:pre">                                </span><input type="text" id="subject" name="subject" class="px" value="" onkeyup="strLenCalc(this, 'checklen', 80);" tabindex="11" style="width: 25em" /></font></div><div align="left"><font size="3"><span style="white-space:pre">                                </span><span>{lang comment_message1} <strong id="checklen">80</strong> {lang comment_message2}</span></font></div><div align="left"><font size="3"><span style="white-space:pre">                        </span></div></font></div>
復制代碼

修改為:

  1. <div align="left"><font size="3"><span style="white-space:pre">                                </span><!--{/if}--></font></div><div align="left"><font size="3"><span style="white-space:pre">                                </span><input type="text" id="subject" name="subject" class="px" value="" onkeyup="strLenCalc(this, 'checklen', 255);" tabindex="11" style="width: 25em" /></font></div><div align="left"><font size="3"><span style="white-space:pre">                                </span><span>{lang comment_message1} <strong id="checklen">255</strong> {lang comment_message2}</span></font></div><div align="left"><font size="3"><span style="white-space:pre">                        </span></div></font></div>
復制代碼

保存文件上傳覆蓋原文件

第四步:修改函數驗證文件

找到文件  /source/function/function_post.php  編輯

找到:

  1. <div align="left"><font size="3"><span style="white-space:pre">        </span>if(dstrlen($subject) > 80) {</font></div><div align="left"><font size="3"><span style="white-space:pre">                </span>return 'post_subject_toolong';</font></div><div align="left"><font size="3"><span style="white-space:pre">        </span>}</font></div>
復制代碼

修改為:

  1. <div align="left"><font size="3"><span style="white-space:pre">        </span>if(dstrlen($subject) > 255) {</font></div><div align="left"><font size="3"><span style="white-space:pre">                </span>return 'post_subject_toolong';</font></div><div align="left"><font size="3"><span style="white-space:pre">        </span>}</font></div>
復制代碼

保存文件上傳覆蓋原文件


第五步:修改語言包文件

找到: source/language/lang_messege.php 下載編輯

找到:

  1.   'post_subject_toolong' => '抱歉,您的標題超過 80 個字符修改標題長度',
復制代碼

修改:

  1.   'post_subject_toolong' => '抱歉,您的標題超過 255 個字符修改標題長度',
復制代碼

最后進入discuz的后臺->工具->更新緩存   之后完畢,耐心等待!
回復

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規則

  • 關注公眾號
  • 有償服務微信
  • 有償服務QQ

手機版|小黑屋|Discuz! 官方交流社區 ( 皖ICP備16010102號 |皖公網安備34010302002376號 )|網站地圖|star

GMT+8, 2025-9-18 14:51 , Processed in 0.077384 second(s), 34 queries .

Powered by Discuz! W1.0 Licensed

Copyright © 2001-2025 Discuz! Team.

關燈 在本版發帖
有償服務QQ
有償服務微信
返回頂部
快速回復 返回頂部 返回列表