[外掛] [原創] 隨機圖片

MODs Released by Other phpbb Sites
非官方認證通過之 MOD ,或許有安全性之疑慮,所有問題由原發表者回覆!

版主: 版主管理群

主題已鎖定
Artemas
竹貓忠實會員
竹貓忠實會員
文章: 489
註冊時間: 2003-08-23 03:18
來自: NorthBlue
聯繫:

[外掛] [原創] 隨機圖片

文章 Artemas »

自己做的MOD喔,這是一個超級簡單實用的外掛,新手都好改喔!
請記得去下載樣本圖檔與說明檔

代碼: 選擇全部

## Random image
##############################################################
## MOD Title: Random image 隨機圖片
## MOD Author: Artemas http://oops.cafepark.com
## MOD Description: Adds the Random images to page header.
##
## Installation Level: easy
## Installation Time: 3 Minutes
## Files To Edit: (1) overall_header.tpl
## Included Files: (1) page_header.php,
## Add Files: (folder) random_img/8 sample pictures 新增圖片資料夾含8張樣本圖,
##############################################################

#
#-----[ OPEN 打開 ]------------------------------------------
#

includes/page_header.php

#
#-----[ FIND 尋找 ]------------------------------------------
#

// Format Timezone. We are unable to use array_pop here, because of PHP3 compatibility

#
#-----[ ABOVE, ADD 上面加入 ]------------------------------------------
#

//
// Random images
//
mt_srand((double)microtime()*1000000);
$imgs = dir('images/random_img');
while ($file = $imgs->read()) {
    if (eregi("gif", $file) || eregi("jpg", $file)) {
	$imglist .= "$file ";
    }
}
closedir($imgs->handle);
$imglist = explode(" ", $imglist);
$a = sizeof($imglist)-2;
$random = mt_rand(0, $a);
$image = $imglist[$random];
$content_img = "<img src=images/random_img/$image border='0' HSPACE='10' alt='Random images'>";

// Random images

#
#-----[ FIND 尋找 ]------------------------------------------
#

	'PRIVMSG_IMG' => $icon_pm,

#
#-----[ ABOVE, ADD 上面加入 ]------------------------------------------
#

	'RANDOM_IMG' => $content_img,

#
#-----[ OPEN 打開 ]------------------------------------------
#

templates/template_name 風格夾/overall_header.tpl

#
#-----[ FIND 尋找 ]------------------------------------------
#

<td><a href="{U_INDEX}">

#
#-----[ OPTIONAL 選擇性更改 ]------------------------------------------
#(OPTIONAL ADD to valign="top") (選擇性加入valign="top")

<td valign="top"><a href="{U_INDEX}">

#
#-----[ FIND 尋找 ]------------------------------------------
#(The "middle" OPTIONAL REPLACE to "top") (選擇性把"middle"改成"top")

<td align="center" width="100%" valign="middle"><span class="maintitle">{SITENAME}

#
#-----[ ABOVE, ADD 上面加入 ]------------------------------------
#

<td valign="top">{RANDOM_IMG}</td>

# 
#-----[ COPY ADD 拷貝新增 ]------------------------------------------ 
#

copy folder (random_img) to ..phpBB2\images
put into any image files(jpg or gif) can be random to show up.

拷貝 random_img 資料夾放置到 ..phpBB2\images
裡面附贈8個樣本圖即可隨機撥放,自己也可以放入任何jpg或gif圖片,名稱任意取(切勿用中文)即可\r

#
#-----[ SAVE/CLOSE ALL FILES 完成 ]--------------------------
#
若懶的下載也無仿,只要自己在..phpBB2\images 底下建立一個random_img的資料夾即可,然後自己丟些圖檔到資料夾中,就會自動隨機出現 :mrgreen:


附註:若對於 <td valign="top">{RANDOM_IMG}</td> 所放置的位置自己覺得不理想
只要把{RANDOM_IMG}找到自己喜歡的地方擺也可以,前提是只能在overall_header.tpl檔案中移動
除非自己有把握把修改 // Random images 這一組移到別的頁面。

參考展示網頁 http://mabinogi.opisite.com/

---------------------------------------------------

這個mod適用phpbb與nuke+(BB首頁)通通都能用啦\r
只不過nuke的overall_header.tpl這個檔案是在\r
..html\themes\DeepBlue風格夾\forums

---------------------------------------------------
圖檔
Os: Windows 2003
Constitute: IIS.6 + php4 + MySql 4 + ODBC + phpMyAdmin2.6.0 + phpBB 2.0.23
url: http://oops.cafepark.com
主題已鎖定

回到「非官方認證外掛」