[外掛]Top 5 mod 不能正常顯視主題

phpBB 2 MOD Support
無論是官方或非官方認證之外掛,安裝與使用問題討論。
(發表文章請按照公告格式發表,違者砍文)

版主: 版主管理群

主題已鎖定
頭像
teapot
星球普通子民
星球普通子民
文章: 19
註冊時間: 2003-08-06 17:41
聯繫:

[外掛]Top 5 mod 不能正常顯視主題

文章 teapot »

問題外掛 : adv_top5_mod_2.1
參考連結:
網站位置:http://www.tonguild.org/phpbb2
狀況描述:
加了mod 之後主題那裡的字型會變成亂碼(最後的幾個字), 請問有方法解決嗎?

謝謝
依夢兒
竹貓忠實會員
竹貓忠實會員
文章: 2013
註冊時間: 2002-11-20 00:07

文章 依夢兒 »

這是正常的,因為TOP 5有顯示主題字元長度的限制。
這是為了避免過長字元的主題將TOP 5給拉寬而設計的。
(字數過多,被拉寬的話,TOP 5右邊是會被切掉的;這在 800x600 螢幕解析度下尤其容易發生)

如果你要調整字元長度,請開啟 adv_top5.php ,搜尋:

代碼: 選擇全部

$MAX_STR_LEN =
將後面的數字改成你要的字元長度就可以了。
有任何關於 phpBB 或是架站的問題,請在論壇上公開發表出來,大家一起討論。
請不要丟私人訊息問我,因為私訊是用來聊私事的。
這樣作對於解決您的問題一點幫助也沒有,也很沒有效率,小弟我一概謝絕。



搜尋是一種美德,在發問之前,請多加利用頂端的文章搜尋功能,搜尋可能的關鍵字。
確定您想問的問題找不到答案後,再發問。
頭像
teapot
星球普通子民
星球普通子民
文章: 19
註冊時間: 2003-08-06 17:41
聯繫:

文章 teapot »

依夢兒 寫: 如果你要調整字元長度,請開啟 adv_top5.php ,搜尋:

代碼: 選擇全部

$MAX_STR_LEN =
將後面的數字改成你要的字元長度就可以了。
謝謝你的回覆啊!
但是我找不到那個代碼....

代碼: 選擇全部

$str = (strlen($str) > $MAX_STR_LEN) ? (substr($str, 0, $MAX_STR_LEN - 1) . "...") : $str;
	return $str;
我想應該是這一句的,
請問要如何修改呢?

謝謝^^
依夢兒
竹貓忠實會員
竹貓忠實會員
文章: 2013
註冊時間: 2002-11-20 00:07

文章 依夢兒 »

teapot 寫:謝謝你的回覆啊!
但是我找不到那個代碼....
就在開頭不遠的地方喲!!
我把我的 adv_top5.php 前半部貼出來給你看,注意看一下紅色的部份:

代碼: 選擇全部

<?php
/***************************************************************************
 *                               adv_top5.php
 *                            -------------------
 *  Contains GPL code copyright of phpBB group.
 *
 *  MOD Name: Top5 topics
 *  Author: OOHOO
 *  Version: 1.x.x for phpBB 2 Beta serial
 *  Version: 2.0.0 for phpBB 2 RC serial
 *  Version: 2.1.0 for phpBB 2.0.0
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

define('IN_PHPBB', true);
$phpbb_root_path = "./";
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);

//
// Mod setting
//
// Topics text length
[color=red]$MAX_STR_LEN = 60;[/color]
// Topics to display
$MAX_TOPICS = 5;
// 0 => users can see all topics including authorized issue(but they cant read the posts)
// 1 => users can see only authorized topics
$AUTH_SECRUITY = 1;

function cutStr($str) {

	global $MAX_STR_LEN;

	$str = (strlen($str) > $MAX_STR_LEN) ? (substr($str, 0, $MAX_STR_LEN - 1) . "...") : $str;
	return $str;
}
不然請你提供你目前使用的TOP 5下載連結給我,我幫你找;可能是你使用的版本和我使用的版本不同。
有任何關於 phpBB 或是架站的問題,請在論壇上公開發表出來,大家一起討論。
請不要丟私人訊息問我,因為私訊是用來聊私事的。
這樣作對於解決您的問題一點幫助也沒有,也很沒有效率,小弟我一概謝絕。



搜尋是一種美德,在發問之前,請多加利用頂端的文章搜尋功能,搜尋可能的關鍵字。
確定您想問的問題找不到答案後,再發問。
頭像
teapot
星球普通子民
星球普通子民
文章: 19
註冊時間: 2003-08-06 17:41
聯繫:

文章 teapot »

@@
改了之後 Top5,現在是字型變大了,顯示4個主題和不能load風, http://tonguild.org/phpbb2
看不到在那裡的風格,

現在貼上我的 adv_top5.php

代碼: 選擇全部

<?php
/***************************************************************************
 *                               adv_top5.php
 *                            -------------------
 *  Contains GPL code copyright of phpBB group.
 *
 *  MOD Name: Top5 topics
 *  Author: OOHOO
 *  Version: 1.x.x for phpBB 2 Beta serial
 *  Version: 2.0.0 for phpBB 2 RC serial
 *  Version: 2.1.0 for phpBB 2.0.0
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

define('IN_PHPBB', true);
$phpbb_root_path = "./";
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);

//
// Mod setting
//
// Topics text length
$MAX_STR_LEN = 60;
// Topics to display
$MAX_TOPICS = 5;
// 0 => users can see all topics including authorized issue(but they cant read the posts)
// 1 => users can see only authorized topics
$AUTH_SECRUITY = 1;

function cutStr($str) {

	global $MAX_STR_LEN;

	$str = (strlen($str) > $MAX_STR_LEN) ? (substr($str, 0, $MAX_STR_LEN - 1) . "...") : $str;
	return $str;
}

//
// gzip_compression
//
$do_gzip_compress = FALSE;
if($board_config['gzip_compress'])
{
	$phpver = phpversion();

	if($phpver >= "4.0.4pl1")
	{
		if(extension_loaded("zlib"))
		{
			ob_start("ob_gzhandler");
		}
	}
	else if($phpver > "4.0")
	{
		if(strstr($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip'))
		{
			if(extension_loaded("zlib"))
			{
				$do_gzip_compress = TRUE;
				ob_start();
				ob_implicit_flush(0);

				header("Content-Encoding: gzip");
			}
		}
	}
}

header ("Cache-Control: no-store, no-cache, must-revalidate");
header ("Cache-Control: pre-check=0, post-check=0, max-age=0", false);
header ("Pragma: no-cache");
header ("Expires: " . gmdate("D, d M Y H:i:s", time()) . " GMT");
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");


//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX, $session_length);
init_userprefs($userdata);
//
// End session management
//


// Find which forums are visible for this user
$is_auth_ary = array();
$is_auth_ary = auth(AUTH_READ, AUTH_LIST_ALL, $userdata);

$auth_forum_ary = array();

// Get forum info
$sql = "SELECT forum_id FROM " . FORUMS_TABLE;

if( !$q_forums = $db->sql_query($sql) )
{
	message_die(GENERAL_MESSAGE, 'ADV_TOP5 MOD ERROR!!');
}

// Authorized forums info
while( $forum_row = $db->sql_fetchrow($q_forums) )
{
	$forum_id = $forum_row['forum_id'];

	if( $is_auth_ary[$forum_id]['auth_read'] == 1)
	{
		array_push($auth_forum_ary, $forum_id);
	}
}

if( sizeOf($auth_forum_ary) == 0 || !$AUTH_SECRUITY )
{
	$auth_forums = "";
}
else
{
	$auth_forums = 'AND f.forum_id IN(';

	if(sizeOf($auth_forum_ary) > 1)
	{
		$auth_forums .= implode (',', $auth_forum_ary);
	}
	else
	{
		$auth_forums .= $auth_forum_ary[0];
	}

	$auth_forums .= ')';
}

// select mode
$mode = ( !empty($HTTP_GET_VARS['mode']) ) ? $HTTP_GET_VARS['mode'] : '';
switch($mode)
{
	case 'last':
		$sortby = "topic_last_post_id";
		break;
	case 'hot':
		$sortby = "topic_views";
		break;
	case 'top':
		$sortby = "topic_replies";
		break;
	default:
		$sortby = "topic_last_post_id";
		$mode = "last";
		break;
}

// nav links
$last_link = ( ($mode == "last") ? "<font style=\"{color: #ff006e}\">« LAST $MAX_TOPICS »</font>" : ('<a href="' . append_sid("adv_top5.$phpEx?mode=last") . '" class="nav">LAST</a>'));
$hot_links = ( ($mode == "hot") ? "<font style=\"{color: #ff006e}\">« HOT $MAX_TOPICS »</font>" : ('<a href="' . append_sid("adv_top5.$phpEx?mode=hot") . '" class="nav">HOT</a>'));
$top_links = ( ($mode == "top") ? "<font style=\"{color: #ff006e}\">« TOP $MAX_TOPICS »</font>" : ('<a href="' . append_sid("adv_top5.$phpEx?mode=top") . '" class="nav">TOP</a>'));

// set template
$template->set_filenames(array("body" => "adv_top5_body.tpl"));

$template->assign_vars(array(
	"icon_url" => $images['icon_latest_reply'],
	"icon_alt" => $lang['View_latest_post'],
	"nav_links" => "$last_link  $hot_links  $top_links"
));

// query
$sql = "SELECT topic_id, topic_title, topic_poster, topic_views, topic_replies, topic_last_post_id, f.forum_id, forum_name
	FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f
	WHERE t.forum_id = f.forum_id
	AND topic_moved_id = '0'
	$auth_forums
	ORDER BY $sortby DESC LIMIT 0, $MAX_TOPICS";

if( !$result = $db->sql_query($sql) )
{
	echo '<p align="center"><font color="red"><b>ADV_TOPN_MOD TOPICS QUERY ERROR!!</b></font></p>';
	exit;
}

// fetch rows
while( $rows = $db->sql_fetchrow($result) )
{
	$topic_url = append_sid("viewtopic.$phpEx?t=" . $rows['topic_id']);
	$forum_url = append_sid("viewforum.$phpEx?f=" . $rows['forum_id']);

	$topic_poster = $rows['topic_poster'];
	$topic_last_post_id = $rows['topic_last_post_id'];

	// Grab topic poster and last replier data
	$sql = "SELECT post_username, user_id, username
		FROM " . POSTS_TABLE . ", " . USERS_TABLE . "
		WHERE topic_id = '" . $rows['topic_id'] . "'
		AND poster_id = user_id
		ORDER BY post_id LIMIT 0, 1";

	if( !$p_result = $db->sql_query($sql) )
	{
		message_die(GENERAL_MESSAGE, 'ADV_TOP5 MOD TOPIC_POSTER QUERY ERROR!!');
	}

	$p_row = $db->sql_fetchrow($p_result);

	$poster_name = ( $topic_poster != ANONYMOUS ) ? $p_row['username'] : ( !$p_row['post_username'] ? $lang['Guest'] : $p_row['post_username']);
	$poster_url = ( $topic_poster != ANONYMOUS && !$p_row['post_username'] ) ? ('<a href="' . append_sid("profile.$phpEx?mode=viewprofile&u=$topic_poster") . '" target="_top">' . "$poster_name</a>") : $poster_name;

	$sql = "SELECT post_username, user_id, username, post_time
		FROM " . POSTS_TABLE . ", " . USERS_TABLE . "
		WHERE post_id = '$topic_last_post_id'
		AND poster_id = user_id";

	if( !$r_result = $db->sql_query($sql) )
	{
		message_die(GENERAL_MESSAGE, 'ADV_TOP5 MOD LAST_REPLIER QUERY ERROR!!');
	}

	$r_row = $db->sql_fetchrow($r_result);

	$replier_id = $r_row['user_id'];
	$replier_name = ( $replier_id != ANONYMOUS ) ? $r_row['username'] : ( !$r_row['post_username'] ? $lang['Guest'] : $r_row['post_username']);
	$replier_url = ( $replier_id != ANONYMOUS && !$r_row['post_username'] ) ? ('<a href="' . append_sid("profile.$phpEx?mode=viewprofile&u=$replier_id") . '" target="_top">' . "$replier_name</a>") : $replier_name;

	$last_post_url = append_sid("viewtopic.$phpEx?p=$topic_last_post_id#$topic_last_post_id");

	$template->assign_block_vars("toprow", array(
		"forum_name" => $rows['forum_name'],
		"forum_url" => $forum_url,
		"topic" => cutStr($rows['topic_title']),
		"topic_url" => $topic_url,
		"topic_views" => $rows['topic_views'],
		"topic_replies" => $rows['topic_replies'],
		"post_time" => create_date($board_config['default_dateformat'], $r_row['post_time'], $board_config['board_timezone']),
		"poster_url" => $poster_url,
		"replier_url" => $replier_url,
		"last_post_url" => $last_post_url
	));
}

$template->assign_vars(array(
	'S_CONTENT_DIRECTION' => $lang['DIRECTION'],
	'S_CONTENT_ENCODING' => $lang['ENCODING'],

	'T_HEAD_STYLESHEET' => $theme['head_stylesheet'],
	'T_BODY_BGCOLOR' => '#'.$theme['body_bgcolor'],
	'T_BODY_TEXT' => '#'.$theme['body_text'],
	'T_BODY_LINK' => '#'.$theme['body_link'],
	'T_BODY_VLINK' => '#'.$theme['body_vlink'],

	'L_FORUM' => $lang['Forum'],
	'L_TOPICS' => $lang['Topics'],
	'L_REPLIES' => $lang['Replies'],
	'L_AUTHOR' => $lang['Author'],
	'L_VIEWS' => $lang['Views'],
	'L_POSTS' => $lang['Posts'],
	'L_LASTPOST' => $lang['Last_Post']
));


//
// Generate the page
//
//$gen_simple_header = TRUE;

//include($phpbb_root_path . 'includes/page_header.'.$phpEx);

$template->pparse("body");

$db->sql_close();
//
// Compress buffered output if required
// and send to browser
//
if($do_gzip_compress)
{
	//
	// Borrowed from php.net!
	//
	$gzip_contents = ob_get_contents();
	ob_end_clean();

	$gzip_size = strlen($gzip_contents);
	$gzip_crc = crc32($gzip_contents);

	$gzip_contents = gzcompress($gzip_contents, 9);
	$gzip_contents = substr($gzip_contents, 0, strlen($gzip_contents) - 4);

	echo "\x1f\x8b\x08\x00\x00\x00\x00\x00";
	echo $gzip_contents;
	echo pack("V", $gzip_crc);
	echo pack("V", $gzip_size);
}

exit;
?>
謝謝幫忙找找我何處出錯了@@
StickyKid
竹貓忠實會員
竹貓忠實會員
文章: 1019
註冊時間: 2003-01-31 10:32
來自: Taichung, Taiwan
聯繫:

文章 StickyKid »

有顯示五個喔~
不過要拖曳下去看
風格的問題應該要去adv_top5.tpl找找\r
裡面會有相關的東西
Helvetica is a feature-length independent film about typography.
頭像
teapot
星球普通子民
星球普通子民
文章: 19
註冊時間: 2003-08-06 17:41
聯繫:

文章 teapot »

現在是字型變大了,所以令風格不能正常顯示@@
有人可以幫我嗎??
>_<
依夢兒
竹貓忠實會員
竹貓忠實會員
文章: 2013
註冊時間: 2002-11-20 00:07

文章 依夢兒 »

teapot 寫:現在是字型變大了,所以令風格不能正常顯示@@
有人可以幫我嗎??
是你動到了 TOP5 的 adv_top5.tpl 或是其它檔案了吧??
adv_top5.php 和字型大小是沒有關係的。

看起來好像是 adv_top5.tpl 的 css 沒有正確的對應到。
有任何關於 phpBB 或是架站的問題,請在論壇上公開發表出來,大家一起討論。
請不要丟私人訊息問我,因為私訊是用來聊私事的。
這樣作對於解決您的問題一點幫助也沒有,也很沒有效率,小弟我一概謝絕。



搜尋是一種美德,在發問之前,請多加利用頂端的文章搜尋功能,搜尋可能的關鍵字。
確定您想問的問題找不到答案後,再發問。
頭像
teapot
星球普通子民
星球普通子民
文章: 19
註冊時間: 2003-08-06 17:41
聯繫:

文章 teapot »

那我貼上 我的 adv_top5_body.tpl,
請大大幫忙看看,我是用fisubsilver 的,
所以只動了那幾個關於風格....

代碼: 選擇全部

<!-- DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" -->
<!-- <html xmlns="http://www.w3.org/1999/xhtml"> -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html dir="{S_CONTENT_DIRECTION}">
<head>
<meta http-equiv="Content-Type" content="text/html; charset={S_CONTENT_ENCODING}"  />
<meta http-equiv="Content-Style-Type" content="text/css" />
<style type="text/css">
<!--
-->
</style>
<link rel="stylesheet" href="templates/fisubSilver/{T_HEAD_STYLESHEET}" type="text/css" />
</head>
<body bgcolor="{T_BODY_BGCOLOR}" text="{T_BODY_TEXT}" link="{T_BODY_LINK}" vlink="{T_BODY_VLINK}">
<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0" style="{background-color: #ECF0F6;}">
  <tr><td height="18" valign="top"><span class="nav">{nav_links}</span></td></tr>
  <tr>
    <td valign="top">
      <table width="100%" border="0" cellpadding="4" cellspacing="1" width="100%" class="forumline">
	<tr> 
	  <th align="center" class="thCornerL" width="20%"> {L_FORUM} </th>
	  <th align="center" class="thTop" width="40%"> {L_TOPICS} </th>
	  <th align="center" class="thTop" nowrap>  {L_AUTHOR}  </th>
	  <th align="center" class="thTop" nowrap> {L_REPLIES} </th>
	  <th align="center" class="thTop" nowrap> {L_VIEWS} </th>
	  <th align="center" class="thCornerR" nowrap> {L_LASTPOST} </th>
	</tr>
	<!-- BEGIN toprow -->
        <tr>
          <td class="row1" nowrap><span class="forumlink"><a href="{toprow.forum_url}" target="_top" class="forumlink">{toprow.forum_name}</a></span></td>       
          <td class="row2" nowrap><span class="topictitle"><a href="{toprow.topic_url}" target="_top" class="topictitle">{toprow.topic}</a></span></td>
          <td class="row1" align="center" nowrap><span class="name">{toprow.poster_url}</span></td>
          <td class="row2" align="center" nowrap><span class="postdetails">{toprow.topic_replies}</span></td>
          <td class="row1" align="center" nowrap><span class="postdetails">{toprow.topic_views}</span></td>
          <td class="row2" align="center" nowrap><span class="postdetails">{toprow.post_time}<br />{toprow.replier_url} <a href="{toprow.last_post_url}" target="_top"><img src="{icon_url}" border="0" alt="{icon_alt}" /></a></span></td>        
        </tr>
        <!-- END toprow -->
      </table>
    </td>  
  </tr>
</table>
</body>
</html>
謝謝^^
StickyKid
竹貓忠實會員
竹貓忠實會員
文章: 1019
註冊時間: 2003-01-31 10:32
來自: Taichung, Taiwan
聯繫:

文章 StickyKid »

代碼: 選擇全部

</style> 
<link rel="stylesheet" href="templates/fisubSilver/{T_HEAD_STYLESHEET}" type="text/css" /> 
</head> 
把這段改成這樣是看看

代碼: 選擇全部

</style> 
<link rel="stylesheet" href="templates/{T_HEAD_STYLESHEET}" type="text/css" /> 
</head> 
Helvetica is a feature-length independent film about typography.
頭像
teapot
星球普通子民
星球普通子民
文章: 19
註冊時間: 2003-08-06 17:41
聯繫:

文章 teapot »

還是一樣的,
沒有改變 >_<
先謝謝啊!
頭像
teapot
星球普通子民
星球普通子民
文章: 19
註冊時間: 2003-08-06 17:41
聯繫:

文章 teapot »

終於發現了是什麼事了@@
又是我大意
在folder內的是 subsilver,
而不是 subSilver....
大寫與小寫的分別@@
謝謝各位啊
頭像
PCHANG
星球公民
星球公民
文章: 47
註冊時間: 2003-10-10 03:10
聯繫:

文章 PCHANG »

各位高手請幫忙
安裝後« LAST 5 » HOT TOP無法正常顯示

出現下列訊息~然後空白\r

代碼: 選擇全部

Template->make_filename(): Error - file does not exist
PS~在最論壇底部
~~~~~~~~~ 感謝您的指導與建議 ~~~~~~~~~

●主機資訊A:(主機商)
==================================
◎作業系統 Linux
◎核心版本 2.4.21-32.ELsmp
◎Apache 版本 1.3.41 (Unix)
◎PHP 版本 4.4.8
◎MySQL 版本 4.1.22-standard-log
◎phpMyAdmin 版本 2.11.4
==================================
●上網方式:光纖 (ISP:HINET-10M以上)。
●phpBB 版本:改版中...。
==================================

:idea: :?: :!: 非老手上陣~請多協助 :!: :?: :idea:
flower
星球公民
星球公民
文章: 272
註冊時間: 2004-08-31 21:03
來自: 火星
聯繫:

文章 flower »

tpl 有複製到該複製的位置?
tpl 的檔名對嗎?
主題已鎖定

回到「外掛問題討論」