首頁顯示總主題及回覆 (追加語系修改)

主題已鎖定
頭像
cloudsnow30
.※.稜鏡之森の守護使者.※.
.※.稜鏡之森の守護使者.※.
文章: 145
註冊時間: 週六 2006-03-04 03:29
個人狀態: 冬眠喵型態
性別:
來自: 雲上天國
擁有感謝: 2 次
星座:
聯繫:

首頁顯示總主題及回覆 (追加語系修改)

文章 cloudsnow30 »

參考自竹貓
http://www.phpbb-tw.net/phpbb/viewtopic ... 60%A5D%C3D

代碼: 選擇全部

[php:1:05412eb30c]<?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:1:05412eb30c]
最後由 cloudsnow30 於 週五 2006-03-10 05:31 編輯,總共編輯了 1 次。
Sakura Moon ~ 櫻井璃月 ~
論壇系統管理員-Cloud Snow 晴雪
頭像
cloudsnow30
.※.稜鏡之森の守護使者.※.
.※.稜鏡之森の守護使者.※.
文章: 145
註冊時間: 週六 2006-03-04 03:29
個人狀態: 冬眠喵型態
性別:
來自: 雲上天國
擁有感謝: 2 次
星座:
聯繫:

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

文章 cloudsnow30 »

原作:心靈補手

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

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

代碼: 選擇全部

#-----[ ?#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 
# 
#-----[ 存檔 ]------------------------------------------ 
Sakura Moon ~ 櫻井璃月 ~
論壇系統管理員-Cloud Snow 晴雪
頭像
cloudsnow30
.※.稜鏡之森の守護使者.※.
.※.稜鏡之森の守護使者.※.
文章: 145
註冊時間: 週六 2006-03-04 03:29
個人狀態: 冬眠喵型態
性別:
來自: 雲上天國
擁有感謝: 2 次
星座:
聯繫:

[建議] 修飾語句

文章 cloudsnow30 »

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

代碼: 選擇全部

#-----[ ?#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} 
# 
#-----[ 存檔 ]------------------------------------------ 
Sakura Moon ~ 櫻井璃月 ~
論壇系統管理員-Cloud Snow 晴雪
主題已鎖定

回到「PHPBB2-外掛列表」