Ok, smider lige hele koden her så er det måske mere klart:
---------------------------------------------------------------
<?
$db=mysql_connect ("xxxxxx", "xxxxxx", "xxxxxxx") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("pryo_phpbbaoc");
$phpbb_prefix="phpbb_";
$news_forum="56";
$forum_location="../phpbb";
$sql_topic = 'SELECT forum_id, topic_id, topic_first_post_id, topic_views, topic_replies, topic_first_poster_name, topic_first_poster_colour FROM `'.$phpbb_prefix.'topics` WHERE forum_id = '.$news_forum.' ORDER BY topic_id ASC';
//echo $sql_topic;
$result_topic = mysql_query($sql_topic) or die('Error: TOPIC SQL');
while ($_topic = mysql_fetch_array($result_topic))
{
$sql_forum ='SELECT forum_name FROM `'.$phpbb_prefix.'forums` WHERE forum_id = '.$news_forum;
$result_forum = mysql_query($sql_forum) or die('Error: FORUM SQL');
while ($_forum = mysql_fetch_array($result_forum))
{
$forum_name = $_forum['forum_name'];
}
$sql_posts = 'SELECT * FROM `'.$phpbb_prefix.'posts` WHERE post_id = '. $_topic['topic_first_post_id'] .' AND post_approved = 1';
$result_posts = mysql_query($sql_posts) or die('Error: POSTS SQL');
while ($_posts = mysql_fetch_array($result_posts))
{
$user_id = $_posts['poster_id'];
$sql_poster = 'SELECT * FROM `'. $phpbb_prefix .'users` WHERE user_id = '.$user_id;
//echo $sql_poster;
$result_poster = mysql_query($sql_poster) or die('Error: USERS SQL');
while ($_poster = mysql_fetch_array($result_poster))
{
if($_topic['topic_replies'] == 0)
{
$template['comments_amount'] = 'No';
$template['comments_plural'] = $comments_plural_form;
}
elseif($_topic['topic_replies'] == 1)
{
$template['comments_amount'] = $_topic['topic_replies'];
$template['comments_plural'] = '';
}
else
{
$template['comments_amount'] = $_topic['topic_replies'];
$template['comments_plural'] = $comments_plural_form;
}
if($_poster['user_avatar_type'] == 2)
{
$template['avatar_url'] = $_poster['user_avatar'];
}
elseif($_poster['user_avatar_type'] == 1)
{
$template['avatar_url'] = $forum_location.'/'.$avatar_location.'/'.$_poster['user_avatar'];
}
else
{
$template['avatar_url'] = '';
}
$template['post_url'] = $forum_location .'/viewtopic.php?f='. $_posts['forum_id'] .'&p='. $_posts['post_id'] .'#p'. $_posts['post_id'];
$template['post_subject'] = $_posts['post_subject'];
$template['profile_url'] = $forum_location . '/memberlist.php?mode=viewprofile&u='. $_posts['poster_id'];
$template['poster'] = $_poster['username'];
$template['poster_colour'] = $_poster['user_colour'];
$template['post_date'] = date($date_format, $_posts['post_time']);
$template['post_text'] = str_ireplace(':'. $_posts['bbcode_uid'], '', $_posts['post_text']);
$template['comments_url'] = $template['post_url'];
$template['add_comment_url'] = $forum_location .'/posting.php?mode=reply&f='. $_posts['forum_id'] .'&t='. $_topic['topic_id'];
$template['pm_post'] = $forum_location .'/forums/ucp.php?i=pm&mode=compose&action=quotepost&p='. $_posts['post_id'];
$template['pm'] = $forum_location .'/ucp.php?i=pm&mode=compose&u='. $_posts['poster_id'];
$template['email_by_board'] = $forum_location .'/memberlist.php?mode=email&u='. $_posts['poster_id'];
$template['email'] = $_posts['user_email'];
$template['news_forum_url'] = $forum_location .'/viewforum.php?f='. $news_forum;
$values = array($template['post_url'], $template['post_subject'],
$template['profile_url'], $template['poster'],
$template['poster_colour'], $template['avatar_url'],
$template['post_date'], $template['post_text'],
$template['comments_url'], $template['comments_amount'],
$template['comments_plural'], $template['add_comment_url'],
$template['pm_post'], $template['pm'],
$template['email_by_board'], $template['email'],
$template['poll_results'], $template['poll_title'],
$template['poll_template'], $template['news_forum_url']);
$events=array(
$dato=substr($template['post_subject'],1,10),
$link=$template['post_url'],
$subject=substr($template['post_subject'],12),
$text=substr($template['post_text'],0,200));
}
}
}
?>
---------------------------------------------
Det er en "event" side til et phpbb3 board, suger nogle topics fra et bestemt forum - kan se den i effekt her (Upcoming events på
www.guild-aoc.com) som du kan se er den ikke sorteret. Der er noget kode jeg har modificeret, så jeg har ikke 100% styr på hvad der sker :P