Kod:
<?php
define('IN_PHPBB', true);
$phpbb_root_path = './forum/';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
$conf['how_many_news'] = '5';
$sql = 'SELECT
t.topic_id,
t.topic_time,
t.topic_title,
pt.post_text,
u.username,
u.user_id,
u.user_rank,
u.user_posts,
t.topic_replies,
pt.bbcode_uid,
t.forum_id,
t.topic_poster,
t.topic_first_post_id,
t.topic_status,
pt.post_id,
p.post_id,
p.enable_smilies
FROM
' . TOPICS_TABLE . ' AS t,
' . USERS_TABLE . ' AS u,
' . POSTS_TEXT_TABLE . ' AS pt,
' . POSTS_TABLE . ' AS p
WHERE
t.forum_id IN (1) AND
t.topic_time <= ' . time() . ' AND
t.topic_poster = u.user_id AND
t.topic_first_post_id = pt.post_id AND
t.topic_first_post_id = p.post_id AND
t.topic_status <> 2
ORDER BY
t.topic_time DESC LIMIT 0, ' . $conf['how_many_news'] . '';
if ($number_of_posts != 0)
{
$sql .= 'LIMIT
0,10';
}
//
// query the database
//
if(!($result = $db->sql_query($sql)))
{
message_die(GENERAL_ERROR, 'Could not query announcements information', '', __LINE__, __FILE__, $sql);
}
while($row = $db->sql_fetchrow($result)){
$tresc = bbencode_second_pass($row['post_text'], $row['bbcode_uid']);
$tresc = make_clickable(smilies_pass($tresc));
$tresc = stripslashes(nl2br($tresc));
echo '<div class="title"><SPAN CLASS="cattitle"><b>Tytuł:</b> <a href="forum/'.append_sid('viewtopic.' . $phpEx . '?t=' . $row['topic_id']).'"class="public" >'.$row['topic_title'].'</a></span></div>';
echo '<div class="public">dodany '.create_date($board_config['default_dateformat'], $row['topic_time'], $board_config['board_timezone']).' przez <a href="' . append_sid('forum/profile.'.$phpEx.'?mode=viewprofile&u='.$row['user_id'].'') . '">'.$row['username'].'</a>';
echo '<br />'.$tresc;
echo '<br /><a href="forum/'.append_sid('viewtopic.' . $phpEx . '?t=' . $row['topic_id']).'" class="public">Komentarze: [ '.$row['topic_replies'].' ]</a>';
echo ' | <a href="'.append_sid('forum/posting.' . $phpEx . '?mode=reply&t=' . $row['topic_id']).'" class="public">Dodaj komentarz</a></div><br />';}
$db->sql_freeresult($result);
?>
nie rozumiem po co masz w kodzie dwa razy
LIMITKod:
if ($number_of_posts != 0)
{
$sql .= 'LIMIT
0,10';
}
to mozesz usunac
Autor postu otrzymał pochwałę
Daj biedakowi rybę, a zje ją i będzie głodny. Daj biedakowi wędkę, a sam sobie bedzie łowił ryby!