1 頁 (共 1 頁)

[外掛]Did You Know?

發表於 : 2004-01-17 18:07
GeniusKiKi
來源:http://www.phpbbhacks.com/viewhack.php?id=2033

[php]## EasyMod 0.0.7 compliant
##############################################################
## MOD Title: Did you know? Box
## MOD Author: Dwing < dwing@weingarten-net.de > (Dimitri Seitz) http://www.dseitz.de
## MOD Description: This Hack will create a 'Did you know?' Box in the phpBB Header. Sentences can be set in the file schon_gewusst.txt
## MOD Version: 1.0.0
##
## Installation Level: easy
## Installation Time: 2 minutes
## Files To Edit: 2
## Included Files: schon_gewusst.txt
##############################################################
## Author Notes: Demo http://www.weingarten-net.de/static/modtest/ (german version)
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################[/php]

[php]#
#-----[ OPEN ]------------------------------------------
#
includes/page_header.php

#
#-----[ FIND ]------------------------------------------
#
// Format Timezone. We are unable to use array_pop here, because of PHP3 compatibility
$l_timezone = explode('.', $board_config['board_timezone']);
$l_timezone = (count($l_timezone) > 1 && $l_timezone[count($l_timezone)-1] != 0) ? $lang[sprintf('%.1f', $board_config['board_timezone'])] : $lang[number_format($board_config['board_timezone'])];


#
#-----[ AFTER, ADD ]------------------------------------------
#
//
// Generate 'Did you know?'
//
$random_file = $phpbb_root_path . 'schon_gewusst.txt';
$random = file($random_file);

srand();
$randomizer = rand(0, count($random) );
$znumber = rand(1, 2);

if( !isset($random[$randomizer]) )
{
$random[$randomizer] = 'More Mods like this <a href="http://www.dseitz.de">here</a>';
}

#
#-----[ FIND ]------------------------------------------
#
'PRIVMSG_IMG' => $icon_pm,

#
#-----[ AFTER, ADD ]------------------------------------------
#
'ZMESSAGE' => $random[$randomizer],
'ZNUMBER' => $znumber,

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

#
#-----[ FIND ]------------------------------------------
#
</table></td>
</tr>
</table>

#
#-----[ AFTER, ADD ]------------------------------------------
#
<!-- Did you know? -->
<br />
<table border="0" align="center" cellpadding="4" cellspacing="0" class="forumline">
<tbody>
<tr>
<th class="thHead"> Did you kow? </th>
</tr>
<tr>
<td class="row{ZNUMBER}"><span class="gen"> {ZMESSAGE} </span></td>
</tr>
</tbody>
</table>
<br clear="all">
<!-- Did you know? -->

#
#-----[ COPY TO FOLDER ]------------------------------------------
#
schon_gewusst.txt to schon_gewusst.txt

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

功能:在首頁新增一個表格顯示隨機的字串

發表於 : 2004-01-18 12:28
動機不明
常見到的應用有

醒世格言
歷史上的今天\r
小技巧\r
....

等等 :-P