[外掛]首頁顯示總主題

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

版主: 版主管理群

主題已鎖定
Devil Eric
星球普通子民
星球普通子民
文章: 14
註冊時間: 2002-10-07 21:08
來自: HK
聯繫:

[外掛]首頁顯示總主題

文章 Devil Eric »

phpBB的首頁只顯示總文章數,並沒有顯示總主題數.
搜尋後,竹貓好像沒有人發表此mod(算是mod嗎? :-D )
我就當仁不讓,獻醜了.

[php]<?php
## 首頁顯示總主題
########################################################
## Mod Title: 首頁顯示總主題
## Mod Author: Eric
## Homepage: http://hgpa.net/php
## Mod Description: 在首頁顯示總主題.
## Mod Version: 0.1
## Installation Level: Easy
## Installation Time: 2-3 Minutes
## Files To Edit: 3
## index.php
## templates\subSilver\index_body.tpl
## language\lang_chinese_traditional_taiwan\lang_main.php
########################################################

#-----[ 開啟 ]------------------------------------------
#
index.php
#
#-----[ 尋找 ]--------------------------------------
#
$total_posts = get_db_stat('postcount');
#
#-----[ 在上面加入 ]--------------------------------
#
$total_topics = get_db_stat('topiccount');
#
#-----[ 尋找 ]--------------------------------------
#
if( $total_posts == 0 )
{
$l_total_post_s = $lang['Posted_articles_zero_total'];
}
else if( $total_posts == 1 )
{
$l_total_post_s = $lang['Posted_article_total'];
}
else
{
$l_total_post_s = $lang['Posted_articles_total'];
}
#
#-----[ 在上面加入 ]--------------------------------
#
if( $total_topics == 0 )
{
$l_total_topic_s = $lang['Posted_topics_zero_total'];
}
else if( $total_topics == 1 )
{
$l_total_topic_s = $lang['Posted_topic_total'];
}
else
{
$l_total_topic_s = $lang['Posted_topics_total'];
}
#
#-----[ 尋找 ]--------------------------------------
#
'TOTAL_POSTS' => sprintf($l_total_post_s, $total_posts),
#
#-----[ 在上面加入 ]--------------------------------
#
'TOTAL_TOPICS' => sprintf($l_total_topic_s, $total_topics),
#
#-----[ 存檔 ]------------------------------------------
#

#-----[ 開啟 ]------------------------------------------
#
templates/subSilver/index_body.tpl
#
#-----[ 尋找 ]--------------------------------------
#
<td class="row1" align="left" width="100%"><span class="gensmall">{TOTAL_POSTS}<br />{TOTAL_USERS}<br />{NEWEST_USER}</span>
#
#-----[ 替換為 ]--------------------------------------
#
<td class="row1" align="left" width="100%"><span class="gensmall">{TOTAL_TOPICS}, {TOTAL_POSTS}<br />{TOTAL_USERS}<br />{NEWEST_USER}</span>
#
#-----[ 存檔 ]------------------------------------------
#

#-----[ 開啟 ]------------------------------------------
#
language/lang_chinese_traditional_taiwan/lang_main.php
#
#-----[ 尋找 ]--------------------------------------
#
$lang['Posted_articles_zero_total'] = '目前沒有發表的文章'; // Number of posts
$lang['Posted_articles_total'] = '目前總共發表了 <b>%d</b> 篇文章'; // Number of posts
$lang['Posted_article_total'] = '目前總共發表了 <b>%d</b> 篇文章'; // Number of posts
#
#-----[ 在上面加入 ]--------------------------------
#
$lang['Posted_topics_zero_total'] = '目前沒有發表的主題'; // Number of topics
$lang['Posted_topics_total'] = '目前總共發表了 <b>%d</b> 篇主題'; // Number of topics
$lang['Posted_topic_total'] = '目前總共發表了 <b>%d</b> 篇主題'; // Number of topics
#
#-----[ 存檔 ]------------------------------------------
#
?>[/php]
頭像
心靈捕手
默默耕耘的老師
默默耕耘的老師
文章: 8535
註冊時間: 2004-04-30 01:54
來自: Taiwan

[補充] 在首頁顯示總回覆數

文章 心靈捕手 »

其實, 我不過是依樣畫葫蘆而已. :oops:

如果, 您已經參考樓頂的文章, 在首頁顯示總主題數,
那麼, 您也可以參考此篇文章, 在首頁顯示總回覆數.

代碼: 選擇全部

#-----[ ?#125;啟 ]------------------------------------------ 
# 
index.php 
# 
#-----[ 尋找 ]-------------------------------------- 
# 
$total_topics = get_db_stat('topiccount'); 
# 
#-----[ 在上面?#91;入 ]-------------------------------- 
#
$total_replys = get_db_stat('postcount')-get_db_stat('topiccount');
# 
#-----[ 尋找 ]-------------------------------------- 
# 
if( $total_topics == 0 ) 
{ 
$l_total_topic_s = $lang['Posted_topics_zero_total']; 
} 
else if( $total_topics == 1 ) 
{ 
$l_total_topic_s = $lang['Posted_topic_total']; 
} 
else 
{ 
$l_total_topic_s = $lang['Posted_topics_total']; 
} 
# 
#-----[ 在上面?#91;入 ]-------------------------------- 
# 
if( $total_replys == 0 ) 
{ 
$l_total_reply_s = $lang['Posted_replys_zero_total']; 
} 
else if( $total_replys == 1 ) 
{ 
$l_total_reply_s = $lang['Posted_reply_total']; 
} 
else 
{ 
$l_total_reply_s = $lang['Posted_replys_total']; 
} 
# 
#-----[ 尋找 ]-------------------------------------- 
# 
'TOTAL_TOPICS' => sprintf($l_total_topic_s, $total_topics), 
# 
#-----[ 在上面?#91;入 ]-------------------------------- 
# 
'TOTAL_REPLYS' => sprintf($l_total_reply_s, $total_replys), 
# 
#-----[ 存檔 ]------------------------------------------ 
# 

#-----[ ?#125;啟 ]------------------------------------------ 
# 
templates/subSilver/index_body.tpl 
# 
#-----[ 尋找 ]-------------------------------------- 
# 
{TOTAL_TOPICS}, {TOTAL_POSTS}
# 
#-----[ 替換為 ]-------------------------------------- 
# 
{TOTAL_TOPICS}, {TOTAL_REPLYS}, {TOTAL_POSTS}
# 
#-----[ 存檔 ]------------------------------------------ 
# 

#-----[ ?#125;啟 ]------------------------------------------ 
# 
language/lang_chinese_traditional_taiwan/lang_main.php 
# 
#-----[ 尋找 ]-------------------------------------- 
# 
$lang['Posted_topics_zero_total'] = '目前沒有發表的主題'; // Number of topics 
$lang['Posted_topics_total'] = '目前總共發表了 <b>%d</b> 篇主題'; // Number of topics 
$lang['Posted_topic_total'] = '目前總共發表了 <b>%d</b> 篇主題'; // Number of topics 
# 
#-----[ 在上面?#91;入 ]-------------------------------- 
# 
$lang['Posted_replys_zero_total'] = '目前沒有發表的回覆'; // Number of replys 
$lang['Posted_replys_total'] = '目前總共發表了 <b>%d</b> 篇回覆'; // Number of replys 
$lang['Posted_reply_total'] = '目前總共發表了 <b>%d</b> 篇回覆'; // Number of replys 
# 
#-----[ 存檔 ]------------------------------------------ 
施比受有福,祝福您好運! ^_^
歡迎光臨★★心靈捕手★★ :: 討論區
https://wang5555.dnsfor.me/phpBB3/
頭像
心靈捕手
默默耕耘的老師
默默耕耘的老師
文章: 8535
註冊時間: 2004-04-30 01:54
來自: Taiwan

[建議] 修飾語句

文章 心靈捕手 »

如果, 您執行了上述兩篇文章的修改後, 覺得語句有點繁瑣的話,
那麼, 可以參考這篇文章的修改:

代碼: 選擇全部

#-----[ ?#125;啟 ]------------------------------------------ 
# 
language/lang_chinese_traditional_taiwan/lang_main.php 
# 
#-----[ 尋找 ]-------------------------------------- 
# 
$lang['Posted_replys_zero_total'] = '目前沒有發表的回覆'; // Number of replys 
$lang['Posted_replys_total'] = '目前總共發表了 <b>%d</b> 篇回覆'; // Number of replys 
$lang['Posted_reply_total'] = '目前總共發表了 <b>%d</b> 篇回覆'; // Number of replys 
$lang['Posted_topics_zero_total'] = '目前沒有發表的主題'; // Number of topics 
$lang['Posted_topics_total'] = '目前總共發表了 <b>%d</b> 篇主題'; // Number of topics 
$lang['Posted_topic_total'] = '目前總共發表了 <b>%d</b> 篇主題'; // Number of topics 
# 
#-----[ 替換為 ]-------------------------------------- 
# 
$lang['Posted_replys_zero_total'] = '沒有發表的回覆'; // Number of replys 
$lang['Posted_replys_total'] = ' <b>%d</b> 篇回覆'; // Number of replys 
$lang['Posted_reply_total'] = ' <b>%d</b> 篇回覆'; // Number of replys 
$lang['Posted_topics_zero_total'] = '其中沒有發表的主題'; // Number of topics 
$lang['Posted_topics_total'] = '其中有 <b>%d</b> 篇主題'; // Number of topics 
$lang['Posted_topic_total'] = '其中有 <b>%d</b> 篇主題'; // Number of topics 
# 
#-----[ 存檔 ]------------------------------------------ 
#

#-----[ ?#125;啟 ]------------------------------------------ 
# 
templates/subSilver/index_body.tpl 
# 
#-----[ 尋找 ]-------------------------------------- 
# 
{TOTAL_TOPICS}, {TOTAL_REPLYS}, {TOTAL_POSTS}
# 
#-----[ 替換為 ]-------------------------------------- 
# 
{TOTAL_POSTS}, {TOTAL_TOPICS}, {TOTAL_REPLYS}
# 
#-----[ 存檔 ]------------------------------------------ 
施比受有福,祝福您好運! ^_^
歡迎光臨★★心靈捕手★★ :: 討論區
https://wang5555.dnsfor.me/phpBB3/
主題已鎖定

回到「非官方認證外掛」