PDA

查看完整版本 : phpBB MOD安裝詳解 - by Martinet 


m27387
2003-11-15, 12:30 AM
這次是我的好友Martinet所發表的文章
內容很詳細,參考一下吧

這裡以BBCode button Mod 作為範例 :

########################################################
## Mod Title: Multiple BBCode MOD
## Mod Version: 1.0.1
## Rev Date: February 3, 2003
##
## Mod Author: Nuttzy < pktoolkit@blizzhackers.com > (n/a) http://www.blizzhackers.com
##
## Mod Description: Allows you to install BBCode MODs that
## add quick BBCode buttons in post edits. Without this
## MOD, there is no standard way of installing BBCode MODs.
##
## Installation Level: EASY
## Installation Time: 2 minutes
## Files To Edit: Two (2)
## posting.php
## templates/subSilver/posting_body.tpl
########################################################
##
## Installation Notes:
##
## + Works with phpBB 2.0.2 thru 2.0.4
## + Do NOT install if you have EasyMod installed
##
## Version History:
## 02/03/03 - updated for 2.0.4
## + no code changes required, just updated the header info
##
## 08/31/02 - initial release
##
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/downloads/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/downloads/
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################


#
#-----[ OPEN ]---------------------------------
#
posting.php
打開posting.php

#
#-----[ FIND ]---------------------------------
#
# NOTE: the full line to look for is:
# make_jumpbox('viewforum.'.$phpEx);
#
make_jumpbox(
在裡面尋找
ps. 正確找到的字串是


#
#-----[ AFTER, ADD ]---------------------------------
#

// EASYMOD-begin
//NOTE: the first element of each array must be '' Add new elements AFTER the ''
$EMBB_keys = array('') ;
$EMBB_widths = array('') ;
$EMBB_values = array('') ;

for ($i=1; $i<count($EMBB_values); $i++)
{
// EasyMod BBcode mods
$val = ($i*2)+16 ;
$template->assign_block_vars('EasyModBB', array(
'KEY' => $EMBB_keys[$i],
'NAME' => "addbbcode$val",
'WIDTH' => $EMBB_widths[$i],
'VALUE' => $EMBB_values[$i],
'STYLE' => "bbstyle($val)")
);
}
// EASYMOD-end

在 make_jumpbox('viewforum.'.$phpEx); 後面加上 :
// EASYMOD-begin

//NOTE: the first element of each array must be '' Add new elements AFTER the ''

$EMBB_keys = array('');

$EMBB_widths = array('');

$EMBB_values = array('');



for ($i=1; $i<count($EMBB_values); $i++)

{

// EasyMod BBcode mods

$val = ($i*2)+16;

$template->assign_block_vars('EasyModBB', array(

'KEY' => $EMBB_keys[$i],

'NAME' => "addbbcode$val",

'WIDTH' => $EMBB_widths[$i],

'VALUE' => $EMBB_values[$i],

'STYLE' => "bbstyle($val)")

);

}[/color]


#
#-----[ OPEN ]---------------------------------
#
templates/subSilver/posting_body.tpl

打開templates/subSilver/posting_body.tpl

#
#-----[ FIND ]---------------------------------
#
# NOTE: the full line to look for is:
# <input type="button" class="button" accesskey="w" name="addbbcode16" value="URL" style="text-decoration: underline; width: 40px" onClick="bbstyle(16)" onMouseOver="helpline('w')" />
# </span></td>
#
name="addbbcode16"
尋找
ps. 找到的完整句子應該看起來像這樣[/color]

#
#-----[ AFTER, ADD ]---------------------------------
#


<td><span class="genmed">
<input type="button" class="button" accesskey="{EasyModBB.KEY}" name="{EasyModBB.NAME}" value="{EasyModBB.VALUE}" style="width: {EasyModBB.WIDTH}px" onClick="{EasyModBB.STYLE}" onMouseOver="helpline('{EasyModBB.KEY}')" />
</span></td>

在後面加上
<!-- BEGIN EasyModBB -->

<td><span class="genmed">

<input type="button" class="button" accesskey="{EasyModBB.KEY}" name="{EasyModBB.NAME}" value="{EasyModBB.VALUE}" style="width: {EasyModBB.WIDTH}px" onClick="{EasyModBB.STYLE}" onMouseOver="helpline('{EasyModBB.KEY}')" />

</span></td>

<!-- END EasyModBB -->[/color]
#
#-----[ FIND ]---------------------------------
#
# NOTE: the full line to look for is:
# <select name="addbbcodefontcolor" onChange="bbfontstyle('.value + ']', '')" onMouseOver="helpline('s')">
#
name="addbbcode18"

尋找
ps.整行看起來應該是這個樣子 :
<select name="addbbcodefontcolor" onChange="bbfontstyle('[color=' + this.form.addbbcodefontcolor.options[this.form.addbbcodefontcolor.selectedIndex].value + ']', '[/color]')" onMouseOver="helpline('s')"></span>


#
#-----[ IN-LINE FIND ]---------------------------------
#
name="addbbcode18"

在同一行的地方找到

#
#-----[ IN-LINE REPLACE ]---------------------------------
#
name="addbbcodefontcolor"

將他取代為
#
#-----[ IN-LINE FIND ]---------------------------------
#
this.form.addbbcode18.options
在同一行裡找到

#
#-----[ IN-LINE REPLACE ]---------------------------------
#
this.form.addbbcodefontcolor.options

將他取代為
#
#-----[ IN-LINE FIND ]---------------------------------
#
this.form.addbbcode18.selectedIndex
在同一行裡找到

#
#-----[ IN-LINE REPLACE ]---------------------------------
#
this.form.addbbcodefontcolor.selectedIndex

將他取代為
#
#-----[ FIND ]---------------------------------
#
# NOTE: the full line to look for is:
# </select> &{L_FONT_SIZE}:<select name="addbbcodefontsize" onChange="bbfontstyle('.value + ']', '')" onMouseOver="helpline('f')">
#
name="addbbcode20"

找到
整段看起來應該是這樣子
#
#-----[ IN-LINE FIND ]---------------------------------
#
name="addbbcode20"

在同一行裡找到
#
#-----[ IN-LINE REPLACE ]---------------------------------
#
name="addbbcodefontsize"
將他取代為name="addbbcodefontsize"

#
#-----[ IN-LINE FIND ]---------------------------------
#
this.form.addbbcode20.options

在同一行裡找到
#
#-----[ IN-LINE REPLACE ]---------------------------------
#
this.form.addbbcodefontsize.options

將他取代為
#
#-----[ IN-LINE FIND ]---------------------------------
#
this.form.addbbcode20.selectedIndex

在同一行裡找到

#
#-----[ IN-LINE REPLACE ]---------------------------------
#
this.form.addbbcodefontsize.selectedIndex
將他取代成

#
#-----[ SAVE/CLOSE ALL FILES ]---------------------------------
#
# EoM

將全部檔檔案存檔並關起來