
Prima di cercare il campo post_text, vorrei chiederti due cose riguardo la query ultimi post:
1) Come mai se scrivo un secondo o terzo post di un topic mi appaiono tutti e tre nel latest post (si trova in basso a sinistra, il riquadro si chiama OltreComics Universe News la pagina è: www.oltrecomics.com/homepage.php).
2) perchè la seguente stringa non funziona:
Codice: Seleziona tutto
$post_subject2 = str_replace("Re: ", "", $row2['topic_last_post_subject']) ;
Codice: Seleziona tutto
$sql2 = "SELECT tt.topic_id, pt.post_id, pt.topic_id, tt.forum_id, tt.topic_poster, tt.topic_desc, tt.topic_moved_id, tt.topic_last_post_id, tt.topic_last_poster_id, tt.topic_last_poster_name, tt.topic_last_post_subject, tt.topic_last_post_time,
ft.forum_id, ft.forum_name
FROM " . TOPICS_TABLE . " tt, " . FORUMS_TABLE . " ft, " . POSTS_TABLE . " pt
WHERE tt.topic_type = 0
AND tt.forum_id = '6'
AND tt.topic_moved_id = 0
AND tt.forum_id = ft.forum_id
AND pt.topic_id = tt.topic_id
ORDER BY tt.topic_last_post_time DESC LIMIT 0,10";
$result2 = $db->sql_query($sql2);
$n2 = 0;
while ($row2 = $db->sql_fetchrow($result2))
{
if ($auth->acl_get('f_read', $row2['forum_id']) == 1)
{
if ($n2 < 5)
{
$post_subject2 = str_replace("Re: ", "", $row2['topic_last_post_subject']) ;
if (strlen($post_subject2) > 28)
{
$post_title2 = substr($post_subject2,0,25) . "...";
}else{
$post_title2 = $post_subject2 ;
}
// accorcia la descrizione del topic
if (strlen($row2['topic_desc']) > 31)
{
$topic_desc2 = substr($row2['topic_desc'],0,30) . "...";
}else{
$topic_desc2 = $row2['topic_desc'];
}
$last_post_link_2[$n2] = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=" . $row5['forum_id'] . "&t=" . $row5['topic_id'] . "#p" . $row5['topic_last_post_id']);
//$last_post_link[$n4] = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=" . $row4['forum_id'] . "&t=" . $row4['topic_id'] . "p#" . $row4['topic_last_post_id']);
$forum_id_2[$n2] = $row2['forum_id'];
$topic_last_post_id_2[$n2] = $row2['topic_last_post_id'];
$last_post_title_2[$n2] = $row2['topic_last_post_subject'];
$last_post_title_short_2[$n2] = $post_title2;
$last_post_forum_2[$n2] = $row2['forum_name'];
$last_post_author_2[$n2] = $row2['topic_last_poster_name'];
$topic_desc_2[$n2] = $row2['topic_desc'];
$desc_short_2[$n2] = $topic_desc2;
$topic_id_2[$n2] = $row2['topic_id'];
$avatar_author_2[$n2] = user_avatar($row2['topic_poster'], '20', '20') ;
$topic_date_2[$n2] = $user->format_date($row2['topic_last_post_time']);
$post_image_2[$n2] = my_img($row2['post_id']);
++$n2 ;
}else{
break ;
}
}
}
Codice: Seleziona tutto
<?php
for ($y = '0';$y < $n2;++$y)
{
// Lista degli ultimi topics
echo "<li class='row'>
<dl class='icon'>
<dt><a href=http://www.oltrecomics.com/forum/viewtopic.php?f=" . $forum_id_2[$y] . "&t=" . $topic_id_2[$y] . "#p" . $topic_last_post_id_2[$y] . "><img src=" . $post_image_2[$y] . " width='40' height='80' alt='' /></a></dt>
<dd class='lastpost'>
<span><a href=http://www.oltrecomics.com/forum/viewtopic.php?f=" . $forum_id_2[$y] . "&t=" . $topic_id_2[$y] . "#p" . $topic_last_post_id_2[$y] . ">" . $last_post_title_short_2[$y] . "</a><br>" . $desc_short_2[$y] . "<br>" . $topic_date_2[$y] . "<br>" . $last_post_forum_2[$y] . "<br>" . $avatar_author_2[$y] . " By: " . $last_post_author_2[$y] . "</span></dd></dl></li>";
}
?>