[修改]Forum-Hotviews修改--目前3筆XD
發表於 : 2004-02-18 11:39
先裝這個 : http://phpbb-tw.net/phpbb/viewtopic.php?t=23166
----------------修改為看該版面的文章也會加該版面的點擊數-------------
打開viewtopic.php
找到\r
$sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.topic_vote, t.topic_last_post_id, f.forum_name, f.forum_status, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, f.auth_vote, f.auth_attachments" . $count_sql . "
FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f" . $join_sql_table . "
WHERE $join_sql
AND f.forum_id = t.forum_id
$order_sql";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not obtain topic information", '', __LINE__, __FILE__, $sql);
}
在行內找到 f.auth_attachments 後面加上
,f.hot_views
找到\r
//
// Generate a 'Show posts in previous x days' select box. If the postdays var is POSTed
// then get it's value, find the number of topics with dates newer than it (to properly
// handle pagination) and alter the main query
//
在前面加上
$sql = "UPDATE `phpbb_forums`
SET `hot_views` = '".($forum_topic_data['hot_views']+1)."'
WHERE `forum_id` = '". $forum_topic_data['forum_id']."'";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'failed updating forum hot views', '', __LINE__, __FILE__, $sql);
}
-------------------修改為百分比顯示------------------------
打開 index.php
找到\r
$forum_data = array();
while( $row = $db->sql_fetchrow($result) )
{
$forum_data[] = $row;
}
在裡面的
$forum_data[] = $row;
下面加上
$total_forum_hotviews += $row['hot_views'];
然後在 } 下面加上
if($total_forum_hotviews==0){$total_forum_hotviews= 1;}
變成
$forum_data = array();
while( $row = $db->sql_fetchrow($result) )
{
$forum_data[] = $row;
$total_forum_hotviews += $row['hot_views'];
}
if($total_forum_hotviews==0){$total_forum_hotviews= 1;}
找到\r
'HOT_VIEWS' => $forum_data[$j]['hot_views'],
取代為\r
'HOT_VIEWS' => sprintf("%.1f", 100*$forum_data[$j]['hot_views']/$total_forum_hotviews).'%',
-----------------------------------------------------
---------------修改為百分比圖示顯示---------------
先裝「修改為百分比顯示」這個修改...
把「這個」圖檔丟到 images/ 下面 (這個圖檔取自Mac大的hp/mp mod..^^")
打開 index.php
找到
'HOT_VIEWS' => sprintf("%.1f", 100*$forum_data[$j]['hot_views']/$total_forum_hotviews).'%',
後面加上
'HOT_VIEWS_SPACE' => (100-sprintf("%.1f", 100*$forum_data[$j]['hot_views']/$total_forum_hotviews)).'%',
打開 templates/your_template/index_body.tpl
找到\r
<td class="row2" align="center" valign="middle" height="50"><span class="gensmall">{catrow.forumrow.HOT_VIEWS}</span></td>
取代為\r
<td class="row2" align="center" valign="bottom" height="50"><img src="images/spacer.gif" alt="" width="9" height="{catrow.forumrow.HOT_VIEWS_SPACE}" /><span class="gensmall"><img src="./images/hotview_bar.gif" alt="{catrow.forumrow.HOT_VIEWS}" title="{catrow.forumrow.HOT_VIEWS}" width="9" height="{catrow.forumrow.HOT_VIEWS}" /><br>{catrow.forumrow.HOT_VIEWS}</span></td>
--------------修改為版面的點擊率到達一定程度就有hot的圖示出現----------
需要先安裝 -------------------修改為百分比顯示------------------------
先把「這個」 抓到 images/ 下面..
打開 index.php
找到\r
$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
$template->assign_block_vars('catrow.forumrow',
array(
前面加上
$hotview_img_hot='';
if(100*$forum_data[$j]['hot_views']/$total_forum_hotviews>30){$hotview_img_hot="<img src =\"images/hot.gif\">";}
找到\r
'HOT_VIEWS' => sprintf("%.1f", 100*$forum_data[$j]['hot_views']/$total_forum_hotviews).'%',
在後面加上
'HOT_IMG' => $hotview_img_hot,
打開 index_body.tpl
找到\r
<a href="{catrow.forumrow.U_VIEWFORUM}" class="forumlink">{catrow.forumrow.FORUM_NAME}</a>
後面加上
{catrow.forumrow.HOT_IMG}
----------------修改為看該版面的文章也會加該版面的點擊數-------------
打開viewtopic.php
找到\r
$sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.topic_vote, t.topic_last_post_id, f.forum_name, f.forum_status, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, f.auth_vote, f.auth_attachments" . $count_sql . "
FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f" . $join_sql_table . "
WHERE $join_sql
AND f.forum_id = t.forum_id
$order_sql";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not obtain topic information", '', __LINE__, __FILE__, $sql);
}
在行內找到 f.auth_attachments 後面加上
,f.hot_views
找到\r
//
// Generate a 'Show posts in previous x days' select box. If the postdays var is POSTed
// then get it's value, find the number of topics with dates newer than it (to properly
// handle pagination) and alter the main query
//
在前面加上
$sql = "UPDATE `phpbb_forums`
SET `hot_views` = '".($forum_topic_data['hot_views']+1)."'
WHERE `forum_id` = '". $forum_topic_data['forum_id']."'";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'failed updating forum hot views', '', __LINE__, __FILE__, $sql);
}
-------------------修改為百分比顯示------------------------
打開 index.php
找到\r
$forum_data = array();
while( $row = $db->sql_fetchrow($result) )
{
$forum_data[] = $row;
}
在裡面的
$forum_data[] = $row;
下面加上
$total_forum_hotviews += $row['hot_views'];
然後在 } 下面加上
if($total_forum_hotviews==0){$total_forum_hotviews= 1;}
變成
$forum_data = array();
while( $row = $db->sql_fetchrow($result) )
{
$forum_data[] = $row;
$total_forum_hotviews += $row['hot_views'];
}
if($total_forum_hotviews==0){$total_forum_hotviews= 1;}
找到\r
'HOT_VIEWS' => $forum_data[$j]['hot_views'],
取代為\r
'HOT_VIEWS' => sprintf("%.1f", 100*$forum_data[$j]['hot_views']/$total_forum_hotviews).'%',
-----------------------------------------------------
---------------修改為百分比圖示顯示---------------
先裝「修改為百分比顯示」這個修改...
把「這個」圖檔丟到 images/ 下面 (這個圖檔取自Mac大的hp/mp mod..^^")
打開 index.php
找到
'HOT_VIEWS' => sprintf("%.1f", 100*$forum_data[$j]['hot_views']/$total_forum_hotviews).'%',
後面加上
'HOT_VIEWS_SPACE' => (100-sprintf("%.1f", 100*$forum_data[$j]['hot_views']/$total_forum_hotviews)).'%',
打開 templates/your_template/index_body.tpl
找到\r
<td class="row2" align="center" valign="middle" height="50"><span class="gensmall">{catrow.forumrow.HOT_VIEWS}</span></td>
取代為\r
<td class="row2" align="center" valign="bottom" height="50"><img src="images/spacer.gif" alt="" width="9" height="{catrow.forumrow.HOT_VIEWS_SPACE}" /><span class="gensmall"><img src="./images/hotview_bar.gif" alt="{catrow.forumrow.HOT_VIEWS}" title="{catrow.forumrow.HOT_VIEWS}" width="9" height="{catrow.forumrow.HOT_VIEWS}" /><br>{catrow.forumrow.HOT_VIEWS}</span></td>
--------------修改為版面的點擊率到達一定程度就有hot的圖示出現----------
需要先安裝 -------------------修改為百分比顯示------------------------
先把「這個」 抓到 images/ 下面..
打開 index.php
找到\r
$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
$template->assign_block_vars('catrow.forumrow',
array(
前面加上
$hotview_img_hot='';
if(100*$forum_data[$j]['hot_views']/$total_forum_hotviews>30){$hotview_img_hot="<img src =\"images/hot.gif\">";}
找到\r
'HOT_VIEWS' => sprintf("%.1f", 100*$forum_data[$j]['hot_views']/$total_forum_hotviews).'%',
在後面加上
'HOT_IMG' => $hotview_img_hot,
打開 index_body.tpl
找到\r
<a href="{catrow.forumrow.U_VIEWFORUM}" class="forumlink">{catrow.forumrow.FORUM_NAME}</a>
後面加上
{catrow.forumrow.HOT_IMG}