Discuz X3.4修改帖子标题80个字符的限制教程
<p style="margin-top: 20px; margin-bottom: 20px;">需要修改5个地方:</p><p style="margin-top: 20px; margin-bottom: 20px;"><strong>1、数据库修改 2、修改JS验证字符数文件 3、修改模板中写死的字符限制数 4、修改函数验证文件 5、修改语言包文件</strong></p><p style="margin-top: 20px; margin-bottom: 20px;"><strong>____________________________________________________________________________</strong></p><p style="margin-top: 20px; margin-bottom: 20px;"><strong>我修改的是200个字符,所以下面介绍的也是修改为200个字符的介绍,自己也可以根据自己的请看看修改~~~~~~(修改前务必先备份,不然哭了不要找我哈)</strong></p><p style="margin-top: 20px; margin-bottom: 20px;"><strong>_____________________________________________________________________________</strong></p><p style="margin-top: 20px; margin-bottom: 20px;">修改的地方比较多,要有耐心!!!</p><p style="margin-top: 5px; margin-bottom: 5px;"><a class="exp-image-wraper" style="color: rgb(45, 100, 179); position: relative; display: block; float: left; text-align: center;"><img class="exp-image-default pic-cursor-pointer" alt="Discuz X3.4修改帖子标题80个字符的限制教程" src="https://www.amitufo.net/bbs/source/plugin/aljtpbdh/img/20250510/1746875355-9272.jpg" _src="source/plugin/aljtpbdh/img/20250510/1746875355-9272.jpg" style="max-width: 100%;"></a></p><h2 class="exp-content-head" style="margin-top: 40px; padding-bottom: 7px; font-variant-numeric: normal; font-variant-east-asian: normal; font-weight: 400; font-stretch: normal; font-size: 22px; line-height: 24px; font-family: 微软雅黑; border-bottom: 1px solid rgb(214, 214, 216);"><a style="color: rgb(45, 100, 179);"></a>工具/原料</h2><ul class="exp-content-unorderlist list-paddingleft-2" style="width: 728.641px; padding-left: 30px; list-style-type: none;"><li style="clear: both;"><p style="margin-top: 5px; margin-bottom: 5px;">DiscuzX3.4</p></li><li style="clear: both;"><p style="margin-top: 5px; margin-bottom: 5px;">代码编辑器(sublime text 3 )</p></li></ul><h2 class="exp-content-head" style="margin-top: 40px; padding-bottom: 7px; font-variant-numeric: normal; font-variant-east-asian: normal; font-weight: 400; font-stretch: normal; font-size: 22px; line-height: 24px; font-family: 微软雅黑; border-bottom: 1px solid rgb(214, 214, 216);"><a style="color: rgb(45, 100, 179);"></a>方法/步骤</h2><ol class="exp-conent-orderlist list-paddingleft-2" style="width: 728.641px; padding-left: 30px; list-style-type: none;"><li style="clear: both;"><p style="margin-top: 5px; margin-bottom: 5px;">1</p><p>首先要修改数据库的地方</p><p>dz论坛后台打开位置到:</p><p>站长--->数据库---->升级</p><p><br></p><p>现在的这个版本 默认没有手动输入SQL 语句地方,需要先开启</p><p> <strong>如果您想自己随意书写 SQL 升级语句,需要将 config/config_global.php 当中的 $_config 设置修改为 1。</strong></p><p><strong>————————————————————————————————</strong></p><p>开启后,输入代码</p><p>ALTER TABLE `pre_forum_post` CHANGE `subject` `subject` VARCHAR(200) NOT NULL;ALTER TABLE `pre_forum_rsscache` CHANGE `subject` `subject` char(200) NOT NULL;ALTER TABLE `pre_forum_thread` CHANGE `subject` `subject` char(200) NOT NULL;</p><p><br></p><p>转换建表语句格式和字符集这个地方我没勾选,然后点击提交</p><p>这样第一步的 数据库修改 就完成了</p><p style="margin-top: 5px; margin-bottom: 5px;"><a class="exp-image-wraper" style="color: rgb(45, 100, 179); position: relative; display: block; float: left;"><img class="exp-image-default pic-cursor-pointer" alt="Discuz X3.4修改帖子标题80个字符的限制教程" src="https://www.amitufo.net/bbs/source/plugin/aljtpbdh/img/20250510/1746875356-3599.jpg" _src="source/plugin/aljtpbdh/img/20250510/1746875356-3599.jpg" style="max-width: 100%;"></a></p><p style="margin-top: 5px; margin-bottom: 5px;"><a class="exp-image-wraper" style="color: rgb(45, 100, 179); position: relative; display: block; float: left;"><img class="exp-image-default pic-cursor-pointer" alt="Discuz X3.4修改帖子标题80个字符的限制教程" src="https://www.amitufo.net/bbs/source/plugin/aljtpbdh/img/20250510/1746875357-2801.jpg" _src="source/plugin/aljtpbdh/img/20250510/1746875357-2801.jpg" style="max-width: 100%;"></a></p></li><li style="clear: both;"><p style="margin-top: 5px; margin-bottom: 5px;">2</p><p>修改JS验证字符数文件 ,js 文件有2个需要修改的</p><p>第一个是:static/js/forum_post.js的74-80行</p><p>else if(mb_strlen(theform.subject.value) > 80) {</p><p>showError('您的标题超过 80 个字符的限制');</p><p>return false;</p><p>}</p><p>其中的两个 80 修改为200 </p><p><br></p><p><br></p><p>第二处是: sitatic/js/forum.js的209到215行代码</p><p>else if(mb_strlen(theform.subject.value) > 80) {</p><p>s = '您的标题超过 80 个字符的限制';</p><p>theform.subject.focus();</p><p>}</p><p>其中的两个 80 也修改为200</p><p>——————————————这样两处js文件就修改好了</p><p style="margin-top: 5px; margin-bottom: 5px;"><a class="exp-image-wraper" style="color: rgb(45, 100, 179); position: relative; display: block; float: left;"><img class="exp-image-default pic-cursor-pointer" alt="Discuz X3.4修改帖子标题80个字符的限制教程" src="https://www.amitufo.net/bbs/source/plugin/aljtpbdh/img/20250510/1746875358-6821.jpg" _src="source/plugin/aljtpbdh/img/20250510/1746875358-6821.jpg" style="max-width: 100%;"></a></p><p style="margin-top: 5px; margin-bottom: 5px;"><a class="exp-image-wraper" style="color: rgb(45, 100, 179); position: relative; display: block; float: left;"><img class="exp-image-default pic-cursor-pointer" alt="Discuz X3.4修改帖子标题80个字符的限制教程" src="https://www.amitufo.net/bbs/source/plugin/aljtpbdh/img/20250510/1746875359-6232.jpg" _src="source/plugin/aljtpbdh/img/20250510/1746875359-6232.jpg" style="max-width: 100%;"></a></p></li><li style="clear: both;"><p style="margin-top: 5px; margin-bottom: 5px;">3</p><p>开始修改3、修改模板中写死的字符限制数 </p><p>有两个文件 需要修改,里面的代码还是比较多的,要小心一些</p><p>第一个文件:/template/default/forum/ 下的post_editor_extra.htm</p><p>查找字符 80 将这个文件里(除了第一个 80 字符)所有的 80 替换为 200</p><p><br></p><p>修改的几处,可以参考 下图</p><p style="margin-top: 5px; margin-bottom: 5px;"><a class="exp-image-wraper" style="color: rgb(45, 100, 179); position: relative; display: block; float: left;"><img class="exp-image-default pic-cursor-pointer" alt="Discuz X3.4修改帖子标题80个字符的限制教程" src="https://www.amitufo.net/bbs/source/plugin/aljtpbdh/img/20250510/1746875360-1750.jpg" _src="source/plugin/aljtpbdh/img/20250510/1746875360-1750.jpg" style="max-width: 100%;"></a></p></li><li style="clear: both;"><p style="margin-top: 5px; margin-bottom: 5px;">4</p><p>第二个文件修改:/template/default/forum/ 下的 forumdisplay_fastpost.htm </p><p>查找字符 80 将这个文件里(除了第一个和最后一个代码的 80 字符)所有的 80 替换为 200 </p><p>修改的地方如图:</p><p style="margin-top: 5px; margin-bottom: 5px;"><a class="exp-image-wraper" style="color: rgb(45, 100, 179); position: relative; display: block; float: left;"><img class="exp-image-default pic-cursor-pointer" alt="Discuz X3.4修改帖子标题80个字符的限制教程" src="https://www.amitufo.net/bbs/source/plugin/aljtpbdh/img/20250510/1746875361-3741.jpg" _src="source/plugin/aljtpbdh/img/20250510/1746875361-3741.jpg" style="max-width: 100%;"></a></p></li><li style="clear: both;"><p style="margin-top: 5px; margin-bottom: 5px;">5</p><p>下面开始修改 :修改函数验证文件 </p><p>打开 : source/function/function_post.php</p><p>查找定位在约361行处</p><p><br></p><p>if(dstrlen($subject) > 80) {return ‘post_subject_toolong’;}</p><p>修改为:</p><p>if(dstrlen($subject) > 200) {return ‘post_subject_toolong’;}</p><p>这样 这个函数验证文件就修改完了</p><p style="margin-top: 5px; margin-bottom: 5px;"><a class="exp-image-wraper" style="color: rgb(45, 100, 179); position: relative; display: block; float: left;"><img class="exp-image-default pic-cursor-pointer" alt="Discuz X3.4修改帖子标题80个字符的限制教程" src="https://www.amitufo.net/bbs/source/plugin/aljtpbdh/img/20250510/1746875362-9121.jpg" _src="source/plugin/aljtpbdh/img/20250510/1746875362-9121.jpg" style="max-width: 100%;"></a></p></li><li style="clear: both;"><p style="margin-top: 5px; margin-bottom: 5px;">6</p><p>开始修改最后一个文件 修改语言包文件</p><p>打开:source/language/lang_messege.php</p><p>查找定位在约998行处,做如下修改:‘post_subject_toolong’ => ‘抱歉,您的标题超过 80 个字符修改标题长度’,</p><p style="margin-top: 5px; margin-bottom: 5px;"><a class="exp-image-wraper" style="color: rgb(45, 100, 179); position: relative; display: block; float: left;"><img class="exp-image-default pic-cursor-pointer" alt="Discuz X3.4修改帖子标题80个字符的限制教程" src="https://www.amitufo.net/bbs/source/plugin/aljtpbdh/img/20250510/1746875363-9696.jpg" _src="source/plugin/aljtpbdh/img/20250510/1746875363-9696.jpg" style="max-width: 100%;"></a></p></li><li style="clear: both;"><p style="margin-top: 5px; margin-bottom: 5px;">7</p><p>到此 修改部分已经修改完了</p><p>记住: 修改后要 更新缓存,不然会有缓存在里面,有报错哈</p><p>更新缓存,在后台--->工具---->更新缓存 里面更新</p></li></ol><p style="margin-top: 5px; margin-bottom: 5px;"><br style="color: rgb(0, 0, 0); font-family: sans-serif; font-size: 16px;"></p>
页:
[1]