52AV手機A片王|52AV.ONE
標題:
discuz x3.2 標題字符從80改成160的方法
[打印本頁]
作者:
IT_man
時間:
2015-1-21 10:13
標題:
discuz x3.2 標題字符從80改成160的方法
==========================================================
% g% Y1 V, O: ?
一、database修改,標題字數(英文字1Byte,中文2Bytes)為160字符:執行sql command:
3 H$ d4 P8 R" p& Q1 I, G0 J
(注意改為你的表前缀)
4 W0 J( B. y; O9 V+ l& F' L
ALTER TABLE `pre_forum_post` CHANGE `subject` `subject` VARCHAR(120) NOT NULL;
: B$ `; S* y! s: m! q* M3 s- n
ALTER TABLE `pre_forum_rsscache` CHANGE `subject` `subject` char(120) NOT NULL;
& U8 W& p- `3 C0 q* U8 l( q
ALTER TABLE `pre_forum_thread` CHANGE `subject` `subject` char(120) NOT NULL;
4 m7 b# @/ x4 l6 A
3 t% ]- o' ]5 j* g
或用phpdbadmin更改也可以
& l1 V+ A! m5 p
==========================================================
" q6 j! w" j* X: A* X; `
二、修改JS驗證字符數:
) l9 O j& u! ?! G$ Y" L
1、找到 static/js/forum_post.js的74-80行
" U- N j& k! z* `; F
if(($('postsubmit').name != 'replysubmit' && !($('postsubmit').name == 'editsubmit' && !isfirstpost) && theform.subject.value == "") || !sortid && !special && trim(message) == "") {
( S/ R4 l8 o0 z, E# r
showError('抱歉,您尚未輸入標題或內容);
: R' ^" S% c; }' J1 M: m
return false;
, k( ?8 w3 c8 a: U& H/ W" m
} else if(mb_strlen(theform.subject.value) > 80) {
. {1 \/ v0 ?& }7 W
showError('您的標題超過 80 個字符的限制');
! R# r+ W x+ m) s$ r; L& `9 B
return false;
% a; O9 j, h* ~# T8 e& V
}
2 U' t$ ]8 q( Z
6 I& W" Z% {% t3 y: Y4 D( V2 ]3 x
數字80改為160
; I( p$ Y. y7 F3 L+ F
==========================================================
1 ?! L+ m* O4 K5 L
2、找到 sitatic/js/forum.js的209到215行:
% ?. `2 |- B! @' R; H: t ?* X
if(theform.message.value == '' && theform.subject.value == '') {
2 z' h, z! }4 z: r
s = '抱歉,您尚未輸入標題或內容';
" H8 r' \3 E) N( S0 r9 p; m1 p
theform.message.focus();
# F4 R, r1 F+ ^- O9 u
} else if(mb_strlen(theform.subject.value) > 80) {
, t y; h! j1 E$ Z, {9 d2 J" p
s = '您的標題超過 80 個字符的限制';
; X, y, r: J6 f% v- H6 H
theform.subject.focus();
8 P4 S! `( z$ U' X q6 h
}
; J! D K3 Z/ f0 R
1 t9 f, z# E* Y* n! x& B
% h8 |4 n7 k N' r. m+ K( W9 ~( C
數字80改為160
& [+ ]5 h/ {0 Y9 }4 ]
==========================================================
9 s0 @4 e* P: I6 E( ?* {( r/ M; `
三、修改模板中寫死的字數限制:
/ {5 s) _& h% z8 ~/ z9 M
1、找到 template\default\forum\post_editor_extra.htm第25行開始
, X3 s" {- p% F4 P* r# l& H; H
修改前
6 h. r2 |8 q- ?5 t9 m* ?8 _
<!--{if $_GET[action] != 'reply'}--
$ |' L8 m; @( r B
<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>
9 _* a" j3 x" f) W) V8 J- b
<!--{else}--><!--reply-->
* L7 ?$ a' U' K S7 N
<span id="subjecthide" class="z">RE: $thread[subject] [<a href="javascript:;"#ff0000">80);return false;">{lang modify}</a>]</span>
' w3 O3 q8 f9 |, d# X8 k
<span id="subjectbox" style="display:none"><input type="text" name="subject" id="subject" class="px" value=""#ff0000">80);" style="width: 25em" /></span>
3 u" p1 g/ A3 M9 Q8 h8 p3 N& o+ z5 w
<!--{/if}-->
1 X# y, F. c$ { e
<span id="subjectchk"{if $_GET[action] == 'reply'} style="display:none"{/if}>{lang comment_message1} <strong id="checklen">80</strong> {lang comment_message2}</span>
- c K! ?# g* x' L% ^: A5 l
<script type="text/javascript">strLenCalc($('subject'), 'checklen',
80
)</script>
! ~+ @3 |+ Y1 U
. a1 d6 L+ ?5 g' J$ ~. f, ]
將紅色數字改為160
- n! Y8 [; n7 ~6 p# E+ _! z6 ^
==========================================================
: ]. ?& n' _- @) J- F5 A# y3 p
2.找到 template\default\forum\forumdisplay_fastpost.htm 地31行開始
" _! c, ]/ ]) G' J2 e
修改前
X7 i3 ?, {3 {! B4 Z' y d
<input type="text" id="subject" name="subject" class="px" value=""#ff0000">80);" tabindex="11" style="width: 25em" />
2 U8 c o* I5 I f
<span>{lang comment_message1} <strong id="checklen">80</strong> {lang comment_message2}</span>
; N+ ~) `) f/ l( T6 A
( S: \2 t' ^0 ?# ?$ d
將紅色數字80改為160,第二個80可改可不改
+ |3 a3 H0 U7 @5 T) V( F7 L3 s
==========================================================
l- A& U) m( e6 X2 h& P
四,修改function驗證提示:
! l3 D$ |$ \! x
source/function/function_post.php的361-363行:
. [4 U) o. g# K
修改前
, s( x u) J6 w" p: P/ X
if(dstrlen($subject) > 80) {
+ J6 n! D$ s$ f/ V4 J7 Q% m$ @% h
return 'post_subject_toolong';
' N, `; N# W3 f: b* l7 V H
}
+ k7 T6 I( e1 n! ~
將數字80改為160
. U' P9 A+ Z7 k* a% V z- M4 g
==========================================================
/ y6 e& e, i2 x- f& O- p/ @# U
五、找到訊息提示文字的php檔,打開 source/language/lang_messege.php 找到998行改為:
2 r1 Y" v- j7 v" W/ N
'post_subject_toolong' => '抱歉,您的標題超過 160 個字符修改標題長度',
& T, R5 B0 g+ t) T1 z! ^
==========================================================
/ W+ u2 P! B& V+ O! ~2 v$ c7 w R W
上面五個步驟完成記得最後最重要的一個步驟是到後台更新緩存才會生效喔
* S, d2 \; N5 ~4 U; |% q
歡迎光臨 52AV手機A片王|52AV.ONE (https://www.52av.one/)
Powered by Discuz! X3.2