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

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

作者: IT_man    時間: 2015-1-21 10:13
標題: discuz x3.2 標題字符從80改成160的方法
==========================================================% N: k$ S7 ~9 N  @
一、database修改,標題字數(英文字1Byte,中文2Bytes)為160字符:執行sql command:+ [2 A+ V7 P' D8 W& S3 P8 l
(注意改為你的表前缀)

* E: [7 v" f6 q! W1 {$ z1 M! {ALTER TABLE `pre_forum_post` CHANGE `subject` `subject` VARCHAR(120) NOT NULL;
: }; V! ]0 ~* E* X; PALTER TABLE `pre_forum_rsscache` CHANGE `subject` `subject` char(120) NOT NULL;
. E3 _* m1 l- y" f! |' fALTER TABLE `pre_forum_thread` CHANGE `subject` `subject` char(120) NOT NULL;
+ J7 f* A, }! l" x5 D+ [$ x
2 z( @8 `  g# y* x! [( D6 R或用phpdbadmin更改也可以; u0 f( X& z" ]$ C0 {; y/ }
==========================================================+ F0 a/ a7 w0 E; |
二、修改JS驗證字符數:
. D, R$ _- W3 F" U4 i# P3 o1、找到 static/js/forum_post.js的74-80行
   
9 d8 B! O* F) Z$ W& e* wif(($('postsubmit').name != 'replysubmit' && !($('postsubmit').name == 'editsubmit' && !isfirstpost) && theform.subject.value == "") || !sortid && !special && trim(message) == "") {5 M4 w. L+ Q1 y: ~. E
                showError('抱歉,您尚未輸入標題或內容);! i0 E- ?8 P: }
                return false;
. ^7 G. z; I3 S! K        } else if(mb_strlen(theform.subject.value) > 80) {
8 Z9 R# d( }* P$ g! ?0 G# |                showError('您的標題超過 80 個字符的限制');
* d$ ~+ k$ z( E                return false;
6 l+ [9 c" G. E  k8 d9 j        }, ?7 [" |2 r  ?7 P- Q; a

$ f: R' D7 x0 [5 Y9 E$ R0 t數字80改為1600 P2 G, x" n4 I) x& t
==========================================================
/ C* {1 ?; ~1 f) ^2、找到 sitatic/js/forum.js的209到215行:
" y$ P& Z: e( j9 Q6 ]if(theform.message.value == '' && theform.subject.value == '') {4 B( u  l! E5 I& C
                s = '抱歉,您尚未輸入標題或內容';
6 D- w) [7 [" T$ P: s( V                theform.message.focus();
, I) I! A& M- H- [        } else if(mb_strlen(theform.subject.value) > 80) {$ k; \+ v# K0 _) ]$ ^. W
                s = '您的標題超過 80 個字符的限制';
$ x1 e  _3 b: W+ d, \. B                theform.subject.focus();( Z- x  [5 U+ X% x: ?# _+ C6 l# c
        }
, \) p2 B5 g% W( T* r1 E/ J# S% H* t) l0 b
1 M1 g, {5 K* U8 Y# L3 N! g; b" A
數字80改為160
' a! x5 m( D* h# f==========================================================; g8 T, ~2 R9 \, i# J# Y
三、修改模板中寫死的字數限制:
4 F3 g! E8 q; M2 [, _' I1、找到 template\default\forum\post_editor_extra.htm第25行開始* a- j, b. b2 L, m
修改前
( f5 h% h; V7 u
                        <!--{if $_GET[action] != 'reply'}--
( U% l$ l) f2 t                                <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># L* E8 x' u, `& H5 R3 X- K
                        <!--{else}--><!--reply-->: }, W7 E+ |7 ^! T0 q
                                <span id="subjecthide" class="z">RE: $thread[subject] [<a href="javascript:;"#ff0000">80);return false;">{lang modify}</a>]</span>1 r: C$ c$ b* i6 ?! I3 F
                                <span id="subjectbox" style="display:none"><input type="text" name="subject" id="subject" class="px" value=""#ff0000">80);" style="width: 25em" /></span>1 L* O1 m1 b# o* w1 k5 w" b
                        <!--{/if}-->                        
/ j5 ~" f+ }8 A2 B+ T! N$ j: d                        <span id="subjectchk"{if $_GET[action] == 'reply'} style="display:none"{/if}>{lang comment_message1} <strong id="checklen">80</strong> {lang comment_message2}</span>
" B- ~/ r; f/ m( I- d# w6 e: Q8 }                        <script type="text/javascript">strLenCalc($('subject'), 'checklen', 80)</script>- M, ?0 {7 W! e
& N5 B7 e* a4 V( S; ^& s
將紅色數字改為160
" p3 w. q" [" O% C2 n8 ?: _==========================================================
  H" W# m8 Y6 P8 l3 K+ B; {2.找到 template\default\forum\forumdisplay_fastpost.htm 地31行開始" I' i! K3 b+ d. U/ h. ^
修改前

) y+ @; d# i1 a) x2 E7 V                                <input type="text" id="subject" name="subject" class="px" value=""#ff0000">80);" tabindex="11" style="width: 25em" />
+ B7 i8 B% w8 }4 R+ t& [7 A( C                                <span>{lang comment_message1} <strong id="checklen">80</strong> {lang comment_message2}</span>
0 R3 n- A4 y. u6 Y. ]) N3 e# B
/ j. {7 d1 W+ ?) r, y$ f3 @. r3 e將紅色數字80改為160,第二個80可改可不改
  `) f# f* R$ Z1 y==========================================================
/ U: ?. U( u+ X! z& _( O% f四,修改function驗證提示:+ z' i$ Z8 `2 |( f- c$ i' g6 Y
source/function/function_post.php的361-363行:
! p% A" l3 O+ _: C5 s7 m% q3 v修改前
- Q& T1 z% x1 Y) s! y) x% T$ fif(dstrlen($subject) > 80) {
4 n3 z2 A- p% mreturn 'post_subject_toolong';$ N" R/ c7 g$ v  j" }
}& f+ R4 p  l4 B! v+ e
將數字80改為160
3 c; Z( P( G* ~9 F+ O$ `' ~, y==========================================================5 ^2 {- E1 u6 I% M6 U( G0 f
五、找到訊息提示文字的php檔,打開 source/language/lang_messege.php 找到998行改為:3 R5 R2 _# e$ \6 j; V* S* A+ W
  'post_subject_toolong' => '抱歉,您的標題超過 160 個字符修改標題長度',0 P0 w, g5 i$ r4 O
==========================================================
! [( c" }; M' d1 h. w' Z2 u" k* ?, u上面五個步驟完成記得最後最重要的一個步驟是到後台更新緩存才會生效喔! Q' ^% T/ s# _6 E# e; u





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