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

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

作者: IT_man    時間: 2015-1-21 10:13
標題: discuz x3.2 標題字符從80改成160的方法
==========================================================" }9 q0 z# A4 N/ i! O
一、database修改,標題字數(英文字1Byte,中文2Bytes)為160字符:執行sql command:
2 h9 Q/ A  L( w) Y(注意改為你的表前缀)

$ U7 S; I8 j( j( ]$ n8 p/ lALTER TABLE `pre_forum_post` CHANGE `subject` `subject` VARCHAR(120) NOT NULL;) J$ |0 m/ G0 k3 m( c8 a; L, E  G
ALTER TABLE `pre_forum_rsscache` CHANGE `subject` `subject` char(120) NOT NULL;. U; v7 B5 O9 V1 M" n4 g
ALTER TABLE `pre_forum_thread` CHANGE `subject` `subject` char(120) NOT NULL;2 l5 b) _7 O+ F( E- E3 x3 z2 ]
  n+ e% W$ F' Z, c8 F/ Q8 ^3 `/ a
或用phpdbadmin更改也可以; x" s& x* Y' `1 H
==========================================================8 d) _7 }4 A2 n4 \& T) z1 c) B
二、修改JS驗證字符數:7 V" m6 X5 z4 g4 v
1、找到 static/js/forum_post.js的74-80行
   % f0 a* ~& ^; Y1 D0 X
if(($('postsubmit').name != 'replysubmit' && !($('postsubmit').name == 'editsubmit' && !isfirstpost) && theform.subject.value == "") || !sortid && !special && trim(message) == "") {! L) @# b5 M2 V- K' `
                showError('抱歉,您尚未輸入標題或內容);
: `$ ]) }8 O% D+ v4 G  e9 z                return false;+ u( N+ _8 R; \, \
        } else if(mb_strlen(theform.subject.value) > 80) {4 P5 B' w5 o) I+ e5 n) z$ X
                showError('您的標題超過 80 個字符的限制');7 a; a) f0 o5 ~" Y* y0 ^
                return false;
. M% ^9 [7 z; s! I+ w/ Q6 j- z        }& a1 C( V6 ^! m

  r- D0 T5 g, O數字80改為160/ {8 a5 y0 J8 [9 |
==========================================================4 w3 `& O& Z% O& F
2、找到 sitatic/js/forum.js的209到215行:6 a  V! I' t8 [
if(theform.message.value == '' && theform.subject.value == '') {8 m% {2 R. i  Z9 k. x# I  J' ^( L
                s = '抱歉,您尚未輸入標題或內容';$ v6 v: @: e# h+ G
                theform.message.focus();
6 G" f/ R) }. n; f: o        } else if(mb_strlen(theform.subject.value) > 80) {, O& W6 A7 L* n& @) ^  i
                s = '您的標題超過 80 個字符的限制';' k- \. {& D5 a! {# {4 \
                theform.subject.focus();8 P. s% F* X3 ]
        }
2 S- p( i7 b" F8 ~  S
6 [9 O  H! N, H  f; }
% n8 D3 M7 A, W, x數字80改為1608 F8 W/ d5 ?2 J/ R9 [
==========================================================
. u- d* `" p, [# R/ l三、修改模板中寫死的字數限制:6 K- j- f/ w  t7 |7 H
1、找到 template\default\forum\post_editor_extra.htm第25行開始0 a) M" w' n* B5 K! S# e6 P9 G
修改前

1 z, q) H4 _2 k% `2 w8 ]8 a# |                        <!--{if $_GET[action] != 'reply'}--
. h8 m: ^! f: [1 V! |+ U0 i                                <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>
  f( r0 }1 X7 E* N1 y9 I: l0 u1 [# i                        <!--{else}--><!--reply-->8 p: J: S- u; A/ d* v. m+ a! J
                                <span id="subjecthide" class="z">RE: $thread[subject] [<a href="javascript:;"#ff0000">80);return false;">{lang modify}</a>]</span>: Y& d' E9 d- W& G4 C
                                <span id="subjectbox" style="display:none"><input type="text" name="subject" id="subject" class="px" value=""#ff0000">80);" style="width: 25em" /></span>
3 t) O" y- w9 N# Z' y& O, P                        <!--{/if}-->                        4 [- @$ E, A) @: o7 F
                        <span id="subjectchk"{if $_GET[action] == 'reply'} style="display:none"{/if}>{lang comment_message1} <strong id="checklen">80</strong> {lang comment_message2}</span>6 H+ x. B1 Y+ @" }$ }: [5 _
                        <script type="text/javascript">strLenCalc($('subject'), 'checklen', 80)</script>
9 J- G+ H7 S: }. o0 E. n3 C; _3 f3 \9 Z& V9 Q$ Z" b, ^
將紅色數字改為160
! C, S3 w: F$ |$ o  n, ~- Z==========================================================/ g% [9 D! o8 S9 B# E/ D& w  @
2.找到 template\default\forum\forumdisplay_fastpost.htm 地31行開始/ y  u1 c; H- k2 ?- o
修改前
8 p: p; |* U- e
                                <input type="text" id="subject" name="subject" class="px" value=""#ff0000">80);" tabindex="11" style="width: 25em" />* p3 F' Y7 L8 X* F, r1 g( F
                                <span>{lang comment_message1} <strong id="checklen">80</strong> {lang comment_message2}</span>  I: {6 h& b- s8 B" C' n8 b
% t' w' L- [1 r1 _, Q; L8 k8 N& Z
將紅色數字80改為160,第二個80可改可不改
7 G: g) H- m0 X! |+ d7 _' h==========================================================' J4 F* t$ w0 |& P: N
四,修改function驗證提示:
/ D2 }3 Z: E$ [source/function/function_post.php的361-363行:
. b  y% t& ~3 A4 h' i; F修改前( y. m8 k& ^  O0 w+ s
if(dstrlen($subject) > 80) {
! M2 l" v# V. W1 z3 Lreturn 'post_subject_toolong';& d, U2 A; x2 v: m
}
5 _9 R# x' ]  n6 P將數字80改為1606 D3 `3 d- m( w
==========================================================1 a7 C+ {+ k( p7 v& x( S' x
五、找到訊息提示文字的php檔,打開 source/language/lang_messege.php 找到998行改為:" t9 D# _. Z% ?. i* q, S9 n
  'post_subject_toolong' => '抱歉,您的標題超過 160 個字符修改標題長度',0 E+ ^( L1 h' ^1 A+ R) m- x: Q
==========================================================' m: u- {1 f1 z$ S
上面五個步驟完成記得最後最重要的一個步驟是到後台更新緩存才會生效喔
6 U/ |+ k2 n7 H% V6 w# C; w7 T% G




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