52AV手機A片王|52AV.ONE

標題: discuz x3.2 標題字符從80改成160的方法 [打印本頁]

作者: IT_man    時間: 2015-1-21 10:13
標題: discuz x3.2 標題字符從80改成160的方法
==========================================================8 Z) I# S$ I6 O: S0 R8 [
一、database修改,標題字數(英文字1Byte,中文2Bytes)為160字符:執行sql command:8 @% |+ x" ^- h) S  Y
(注意改為你的表前缀)
* u* q" f9 R. L$ U7 Z
ALTER TABLE `pre_forum_post` CHANGE `subject` `subject` VARCHAR(120) NOT NULL;
- x: L4 }& v. |" mALTER TABLE `pre_forum_rsscache` CHANGE `subject` `subject` char(120) NOT NULL;
# T  Q% S1 l" IALTER TABLE `pre_forum_thread` CHANGE `subject` `subject` char(120) NOT NULL;
6 ]/ H) X+ P  r2 n! j$ m" Z$ o
( a, X) ]' D$ \1 M0 }, x/ A或用phpdbadmin更改也可以) H% @; j7 e/ [: H% i9 z
==========================================================* a# s) x; K5 w1 T
二、修改JS驗證字符數:' h7 l+ v/ a, A
1、找到 static/js/forum_post.js的74-80行
   
; V0 V: I! m/ l: L3 ^if(($('postsubmit').name != 'replysubmit' && !($('postsubmit').name == 'editsubmit' && !isfirstpost) && theform.subject.value == "") || !sortid && !special && trim(message) == "") {
1 J, q( Y$ e5 `0 r0 E$ _0 n  t                showError('抱歉,您尚未輸入標題或內容);5 u& q9 J2 J" ]$ W5 O( l
                return false;
0 l/ a, _  R* m, S; b2 {1 V        } else if(mb_strlen(theform.subject.value) > 80) {
1 x- I! X" s# I1 C- ]7 M: B+ m$ ?                showError('您的標題超過 80 個字符的限制');
! C  c8 }6 L' y- Y+ y- M. J$ z                return false;
! `0 R+ R) k( ]# B5 A9 g. w( _( _        }
$ B, o8 x7 Q5 Q/ O1 n! n
# n5 L- `. I- ~( V$ U數字80改為160
9 m5 N9 [& {# t( T==========================================================: i; q- \3 m* y; U4 I4 N
2、找到 sitatic/js/forum.js的209到215行:
& z- i6 F8 r+ r/ d& m' S. [if(theform.message.value == '' && theform.subject.value == '') {) k! L1 n5 n- v7 D
                s = '抱歉,您尚未輸入標題或內容';6 i; C3 T  w+ u/ G
                theform.message.focus();
7 S9 d  Q+ j# m/ y1 G        } else if(mb_strlen(theform.subject.value) > 80) {: l0 U' B" O: i; D* Y' v
                s = '您的標題超過 80 個字符的限制';
: ?- H. G6 z; I/ U                theform.subject.focus();, j; `. w1 }7 N: ~. m& S; F3 i
        }/ L/ N* y2 s) @5 K$ N% h/ {
& d; L$ U+ n5 Y, }+ ?

3 n8 ^& _1 c" `6 t" M數字80改為160
4 ~& ^; m$ T5 s9 |# J7 ]3 z, [==========================================================4 i* |# V  o( p
三、修改模板中寫死的字數限制:5 ^+ V( [9 V# P6 ~# t3 M# ?! H0 o$ n- W
1、找到 template\default\forum\post_editor_extra.htm第25行開始
$ w. _% }3 ], l8 w2 i9 K修改前
% M" L; D7 c& [  d' F+ |
                        <!--{if $_GET[action] != 'reply'}--) P+ q4 o! o* Y6 H+ H/ O: S& |
                                <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}#ff0000">80);" style="width: 25em" tabindex="1" /></span>' x; c0 Y, X( R. S: k* M7 c3 u, o) Z; A
                        <!--{else}--><!--reply-->
& X. I# Q2 e% W! ~; b0 b                                <span id="subjecthide" class="z">RE: $thread[subject] [<a href="javascript:;"#ff0000">80);return false;">{lang modify}</a>]</span>3 k% n+ K, u4 G# t; d2 x% V
                                <span id="subjectbox" style="display:none"><input type="text" name="subject" id="subject" class="px" value=""#ff0000">80);" style="width: 25em" /></span>7 ~/ x+ U. [3 I% w1 Y
                        <!--{/if}-->                        
" N* e% ^1 ?) P+ N7 j                        <span id="subjectchk"{if $_GET[action] == 'reply'} style="display:none"{/if}>{lang comment_message1} <strong id="checklen">80</strong> {lang comment_message2}</span>  Y: E* w7 p; y8 f3 L
                        <script type="text/javascript">strLenCalc($('subject'), 'checklen', 80)</script>! a. x! K: ~5 g! v. B; E4 T

5 \! {( m6 F& {; z! |* b將紅色數字改為160" t( q9 k* X9 g2 |" o
==========================================================
% H0 m# b/ e0 U8 W, X$ b2.找到 template\default\forum\forumdisplay_fastpost.htm 地31行開始
" v! d' K. h8 M. I3 H修改前
+ c' g3 b. k0 ~' c5 F
                                <input type="text" id="subject" name="subject" class="px" value=""#ff0000">80);" tabindex="11" style="width: 25em" />4 L( H! H7 Q5 l! O: `; z
                                <span>{lang comment_message1} <strong id="checklen">80</strong> {lang comment_message2}</span>
% J* u7 K. W/ m; r4 |5 s6 p2 ?) H6 m. p$ V7 D5 C$ }
將紅色數字80改為160,第二個80可改可不改- z0 X0 @  z" ?4 z6 G* c
==========================================================/ J; S& V" ^$ `' `8 t
四,修改function驗證提示:
" \; T: v, Z: j6 R" }5 c+ vsource/function/function_post.php的361-363行:- R4 N& u* C& s; T1 a3 Q
修改前9 x7 H. b* I7 n$ f+ K! }/ M
if(dstrlen($subject) > 80) {
/ h! X( W+ m0 B* Breturn 'post_subject_toolong';
5 z5 n/ j( _$ t' U2 G$ u# W/ E5 a}
0 T! A" n5 y0 _( N7 X% n8 e將數字80改為160) ?$ W, O3 N* X1 x4 l/ `' ~
==========================================================! k# w4 S) v5 A8 k6 d: g4 A
五、找到訊息提示文字的php檔,打開 source/language/lang_messege.php 找到998行改為:
  {; T$ x" R- [$ ^' r6 u  'post_subject_toolong' => '抱歉,您的標題超過 160 個字符修改標題長度',
3 J& j9 r: t3 t" Z6 f==========================================================8 @. l. M8 P/ _( }
上面五個步驟完成記得最後最重要的一個步驟是到後台更新緩存才會生效喔
: \; D0 @" g2 g# L* M




歡迎光臨 52AV手機A片王|52AV.ONE (https://www.52av.one/) Powered by Discuz! X3.2