分享--在首頁增加隨機圖片輪播、最新主題最新回覆

MODs Released by Other phpbb Sites
歡迎推薦非官方認證外掛,或許有安全性之疑慮,所有問題由原發表者回覆!

版主: 版主管理群譯文組

版面規則
所謂「非官方認證外掛」是指未經官方認證,發表在 [3.0.x] MODs in Development 版面的外掛。

為了維護推薦外掛之品質,自即日起,如果要在這個版面推薦外掛,那麼請遵守底下格式,謝謝合作!

發文格式:
  • 外掛名稱:(原文/中文化名稱)
  • 外掛作者:(原文)
  • 外掛描述:(原文/中文化描述)
  • 外掛版本:(原文)
  • 外掛下載:(連結位址)
  • 資料來源:(連結位址)
    --
  • 中文化分享:(若外掛無須修改語言檔、或無須上傳語言檔,則免之。)
    --
  • 使用後心得:(簡單陳述您的安裝經驗、使用心得、或其他注意事項。)


p.s.
這個版面之發文,需經版主審核。
主題已鎖定
a0807121
星球普通子民
星球普通子民
文章: 9
註冊時間: 2005-02-20 16:39

分享--在首頁增加隨機圖片輪播、最新主題最新回覆

文章 a0807121 »

外掛名稱: andymod
外掛作者: andy < andy@we-shop.net > (WE SHOP 網頁夢工場) http://www.we-shop.net
外掛描述: 在首頁增加隨機圖片輪播、最新主題最新回覆
外掛版本:8.1.16
外掛下載:
下載
--
展示地點:
http://bbs.we-shop.net/index.php
--
安裝方法:
## 複製andymod整個資料夾到根目錄

##直接複製includes/functions.php到includes目錄覆蓋原檔

##---------------打開includes資料夾內的functions.php------------------
找到約733行~751行
function language_select($default = '')
{
global $db;

$sql = 'SELECT lang_iso, lang_local_name
FROM ' . LANG_TABLE . '
ORDER BY lang_english_name';
$result = $db->sql_query($sql);

$lang_options = '';
while ($row = $db->sql_fetchrow($result))
{
$selected = ($row['lang_iso'] == $default) ? ' selected="selected"' : '';
$lang_options .= '<option value="' . $row['lang_iso'] . '"' . $selected . '>' . $row['lang_local_name'] . '</option>';
}
$db->sql_freeresult($result);

return $lang_options;
}
----------------整個函式更改為---------------------------------
function language_select($default = '',$id='')
{
global $db;

$laforums="10";//顯示多少主題
$table_prefix='phpbb_';//資料表前置詞

if($id=='') {
$sql = 'SELECT lang_iso, lang_local_name
FROM ' . LANG_TABLE . '
ORDER BY lang_english_name';
$result = $db->sql_query($sql);

$lang_options = '';
while ($row = $db->sql_fetchrow($result))
{
$selected = ($row['lang_iso'] == $default) ? ' selected="selected"' : '';
$lang_options .= '<option value="' . $row['lang_iso'] . '"' . $selected . '>' . $row['lang_local_name'] . '</option>';
}
$db->sql_freeresult($result);

return $lang_options;
}else if($id=='1') {
/////////////////////////////////////////////////////////////////////
}else if($id=='3') {
$sqlposts="select * from ".$table_prefix."posts WHERE post_id % 10 > 1 order by post_time desc limit 0,$laforums";
$resultposts = $db->sql_query($sqlposts);

$newreply = '<div style="height:220px;overflow:auto;">';
while($rowposts = mysql_fetch_array($resultposts)){
$userid='';
$sqluser="select user_id,username from ".$table_prefix."users WHERE user_id ='".$rowposts['poster_id']."'";
$resultuser = mysql_query($sqluser);
$rowuser= mysql_fetch_array($resultuser);
$userid=$rowuser['user_id'];

$num++;
$post_title ='';
$date = date("Y年m月d日 g:i a", $rowposts['post_time'] );
$post_title = $rowposts['post_subject'];
$newreply .= '<div>【'.$num.'】';
$newreply .= '<a href="viewtopic.php?f='.$rowposts['forum_id'].'&t='.$rowposts['topic_id'].'&p='.$rowposts['poster_id'].'#p'.$rowposts['post_id'].'" target="_blank" alt="'.$rowposts['post_subject'].'" title="'.$rowposts['post_subject'].'">'.$post_title.'</a>';
$newreply .= ' 【<a href="memberlist.php?mode=viewprofile&u='.$userid.'" alt="檢視'.$rowuser['username'].'的個人資料" title="檢視'.$rowuser['username'].'的個人資料" > '.$rowuser['username'].'</a>】發表於:'.$date.'</div>';
}
$newreply .= '</div>';
return $newreply;
}
}
找到約3322行
'PAGE_TITLE' => $page_title,
之後增加
'NEWREPLY' => language_select( '','3'),
存檔

4.
----------------打開風格模版資料夾內的index_body.html------------------
第二行
<!-- INCLUDE overall_header.html -->
後面加上
<table class="forabg" width="100%" cellpadding="2" cellspacing="2" border="0"style="border:1px solid #fff;">
<tr style="line-height:130%;font-size:15px;font-weight : bold;padding:3px;">
<td align="center" width="300">隨機圖片</td>
<td align="center">最新張貼主題與回覆</td><tr>
<tr><td align="center">
<iframe src ="andymod/" width="300" height="225" frameborder="0" border="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>
</td><td valign="top" class="row1">
{NEWREPLY}
</td></tr></table>

隨機圖片請從andymod/index.php修改
圖片請放在andymod/images資料夾內,可以以資料夾分類,程式自動搜尋檔案

完成
主題已鎖定

回到「[3.0.x] 非官方認證外掛」