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

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

作者: IT_man    時間: 2015-1-21 10:13
標題: discuz x3.2 標題字符從80改成160的方法
==========================================================0 [+ @* ~6 q' q" m1 j
一、database修改,標題字數(英文字1Byte,中文2Bytes)為160字符:執行sql command:+ g2 R4 b5 G- j3 q0 g
(注意改為你的表前缀)
9 a, R/ K% u; T, Z8 X( h
ALTER TABLE `pre_forum_post` CHANGE `subject` `subject` VARCHAR(120) NOT NULL;
  P7 A8 A9 N& O9 J  @ALTER TABLE `pre_forum_rsscache` CHANGE `subject` `subject` char(120) NOT NULL;/ s$ ^! F" S% F. C8 N# e% ~
ALTER TABLE `pre_forum_thread` CHANGE `subject` `subject` char(120) NOT NULL;, ^& Z4 |1 q7 x
8 Y+ w1 x  w% {* D6 ^
或用phpdbadmin更改也可以
  [: `5 A9 n+ R" h! H==========================================================7 Z, l2 A! P" a* l2 c
二、修改JS驗證字符數:
% \4 B1 w& p" A" R# v3 r, @1、找到 static/js/forum_post.js的74-80行
   
3 N2 s6 x" u8 [( b4 x$ bif(($('postsubmit').name != 'replysubmit' && !($('postsubmit').name == 'editsubmit' && !isfirstpost) && theform.subject.value == "") || !sortid && !special && trim(message) == "") {
* y# V* S; a1 H                showError('抱歉,您尚未輸入標題或內容);1 Q* |7 ]7 [2 o. h- d3 Z. W: ^
                return false;8 Y. f4 x+ x8 v# P3 N& k! W' }1 a
        } else if(mb_strlen(theform.subject.value) > 80) {
) q2 ~, ^( ]5 Z( W. U$ E, B                showError('您的標題超過 80 個字符的限制');
" {/ r0 v4 D2 |$ N/ a" Z& k) `! y                return false;' a0 o# k; `1 A6 H' Z( v% C/ d4 L& Q
        }
6 r' i) b4 L. Y
! G  K% @2 D8 a: g數字80改為1601 u1 |. t- {( m) }7 G2 w
==========================================================
) b8 I: D. h2 X6 Z" H# n2、找到 sitatic/js/forum.js的209到215行:& g8 f3 C6 c8 D  u
if(theform.message.value == '' && theform.subject.value == '') {
7 U( i4 H0 z, o% y                s = '抱歉,您尚未輸入標題或內容';
+ m9 [* O/ g% _$ ^3 J4 T! Z                theform.message.focus();2 M8 s! y$ B( O$ F8 H% z6 U, J3 d
        } else if(mb_strlen(theform.subject.value) > 80) {: t- D5 e  `+ F4 H; _
                s = '您的標題超過 80 個字符的限制';
! t+ y. [1 q9 J8 ~/ A8 d+ K                theform.subject.focus();. P0 }# `& J1 I) Q3 g! _) A
        }
' s5 q4 g. W* X$ _/ [4 H% U- B" l' t& D7 s, C- G- J
1 Z8 b1 t- X: ~
數字80改為160' N/ K- K2 U' V( s
==========================================================6 M) s  s! t& ?, Q
三、修改模板中寫死的字數限制:
- F+ V9 u, T7 A% F  u9 g( w  C1、找到 template\default\forum\post_editor_extra.htm第25行開始
  B, w9 l- `$ q* p& Z$ H修改前

; A9 m' y6 a/ Z3 S, J                        <!--{if $_GET[action] != 'reply'}--8 H2 \- {) @5 c4 g+ _& r
                                <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( A& @8 t- t" M
                        <!--{else}--><!--reply-->+ L7 y. T5 ], r; h; j
                                <span id="subjecthide" class="z">RE: $thread[subject] [<a href="javascript:;"#ff0000">80);return false;">{lang modify}</a>]</span>
% O- \3 @2 s; H$ P# D5 i                                <span id="subjectbox" style="display:none"><input type="text" name="subject" id="subject" class="px" value=""#ff0000">80);" style="width: 25em" /></span>0 h( ]8 e' \- ]) s" f( w( }
                        <!--{/if}-->                        5 F, z( P. h0 p
                        <span id="subjectchk"{if $_GET[action] == 'reply'} style="display:none"{/if}>{lang comment_message1} <strong id="checklen">80</strong> {lang comment_message2}</span>& x4 M# u4 N7 g) X$ T, G' h2 K; g
                        <script type="text/javascript">strLenCalc($('subject'), 'checklen', 80)</script>
4 @2 M, b/ t; n+ J9 U' j! r; p
將紅色數字改為160
/ p; V( o. q9 \. s! e==========================================================
- k# V5 @6 z3 D  K' J- P2.找到 template\default\forum\forumdisplay_fastpost.htm 地31行開始
/ z. D& i0 v; j3 t$ z修改前

& m* p& o% k. p( _2 Q                                <input type="text" id="subject" name="subject" class="px" value=""#ff0000">80);" tabindex="11" style="width: 25em" />
0 x: y0 w# |: K4 b                                <span>{lang comment_message1} <strong id="checklen">80</strong> {lang comment_message2}</span>
) R6 G5 L9 K- A: e9 H- q; X* L  d+ d- h: q; i- t6 _
將紅色數字80改為160,第二個80可改可不改
9 s7 M* _- U9 T==========================================================; D1 Z% F: {8 l
四,修改function驗證提示:" V3 q; m' B4 A4 r! l- Y
source/function/function_post.php的361-363行:+ K! i. m( C3 n4 Z3 e% M  M
修改前
- d0 n5 i% U! S& Wif(dstrlen($subject) > 80) {
* }$ T" k2 ?! I7 S( kreturn 'post_subject_toolong';1 b8 O3 X. A% Z1 ^' Q9 ]# q
}
8 Q3 ?! @0 z! ~/ o2 ^% Q將數字80改為1601 P4 S( H( g* o" {: ]' C
==========================================================, p9 W3 l2 v; R; j0 D$ f% M  z
五、找到訊息提示文字的php檔,打開 source/language/lang_messege.php 找到998行改為:3 c1 A: r! }' c
  'post_subject_toolong' => '抱歉,您的標題超過 160 個字符修改標題長度',( ~2 }! [/ w- S6 o
==========================================================
% ]5 p3 ^4 z/ J; {5 T. l8 @上面五個步驟完成記得最後最重要的一個步驟是到後台更新緩存才會生效喔
! Z- F: w& M% v. U) z) l9 f




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