Questa è la query:
Codice: Seleziona tutto
<?php
//---------- 5 Interviste news -----------//
$sql = "SELECT pt.post_id, pt.topic_id, pt.forum_id, pt.post_subject, pt.post_time, pt.poster_id, tt.topic_poster,
tt.topic_id, tt.topic_title, tt.topic_last_post_time, tt.topic_desc,
ut.user_id, ut.username,
ft.forum_id, ft.forum_name
FROM " . POSTS_TABLE . " pt, " . TOPICS_TABLE . " tt, " . FORUMS_TABLE . " ft, " . USERS_TABLE . " ut
WHERE pt.poster_id = ut.user_id
AND pt.forum_id = ft.forum_id
AND tt.forum_id = '22'
AND tt.topic_id = pt.topic_id
ORDER BY tt.topic_last_post_time DESC LIMIT 0,20";
$result = $db->sql_query($sql);
$n = 0 ;
$lista_topics = '' ;
while ($row = $db->sql_fetchrow($result))
{
if ($auth->acl_get('f_read', $row['forum_id']) == 1)
{
if( strpos($lista_topics, $row['topic_id']) == '0' AND $n < 5 )
{
if (strlen($row['topic_title']) > 28)
{
$post_title0 = substr($row['topic_title'],0,27) . "...";
}else{
$post_title0 = $row['topic_title'];
}
// accorcia la descrizione del topic
if (strlen($row['topic_desc']) > 38)
{
$topic_desc0 = substr($row['topic_desc'],0,34) . "...";
}else{
$topic_desc0 = $row['topic_desc'];
}
// $last_post_link[$n4] = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=" . $row4['forum_id'] . "&t=" . $row4['topic_id'] . "#p" . $row4['post_id']);
$last_post_title[$n] = $row['topic_title'];
$last_post_title_short[$n] = $post_title0;
// $last_post_forum_1[$n1] = $row1['forum_name'];
$last_post_author[$n] = $row['username'];
$lista_topics .= "," . $row['topic_id'] ;
$topic_id[$n] = $row['topic_id'] ;
$post_id[$n] = $row['post_id'];
$forum_id[$n] = $row['forum_id'];
$post_image[$n] = my_img($row['post_id']);
$avatar_author[$n] = user_avatar($row['user_id'], '20', '20') ;
$topic_date[$n] = $user->format_date($row['topic_last_post_time']);
$topic_desc[$n] = $row['topic_desc'];
$desc_short[$n] = $topic_desc0;
++$n ;
}
}
}
//---------- 5 Interviste news end -----------//
?>
Codice: Seleziona tutto
<?php
// Lista degli ultimi topics
for ($y = '0';$y < $n;++$y)
{
echo "<li class='row'>
<dl class='icon'>
<dt><a href=http://www.oltrecomics.com/forum/viewtopic.php?f=" . $forum_id[$y] . "&t=" . $topic_id[$y] . "#p" . $post_id[$y] . "><img src=" . $post_image[$y] . " width='40' height='60' alt='' /></a></dt>
<dd class='lastpost'><span><a href=http://www.oltrecomics.com/forum/viewtopic.php?f=" . $forum_id[$y] . "&t=" . $topic_id[$y] . "#p" . $post_id[$y] . ">" . $last_post_title_short[$y] . "</a><br>" . $desc_short[$y] . "<br>" . $topic_date[$y] . "<br>" . $avatar_author[$y] . " by: (" . $last_post_author[$y] . ")</span></dd></dl></li>" ;
}
?>
C'è solo un problema con jcarousel: i vari post di un topic fortunatamente non vengono visualizzati, ma disgraziatamente lasciano uno spazio bianco

Su firebug si presenta in questo modo:
Codice: Seleziona tutto
<li class="jcarousel-item jcarousel-item-horizontal jcarousel-item-6 jcarousel-item-6-horizontal" style="float: left; list-style: none outside none;" jcarouselindex="6"><a href="http://www.oltrecomics.com/forum/viewtopic.php?t=80#p170"><img height="150" alt="" src="width='80'"></a><br></li>
E' possibile mettere il condizionale IF in questo codice:
Codice: Seleziona tutto
<?php
for ($y = '0';$y < $n5;++$y)
{
echo "<li><a href=http://www.oltrecomics.com/forum/viewtopic.php?t=" . $topic_id_5[$y] . "#p" . $post_id_5[$y] . "><img src=" . $post_image_5[$y] . " width='80' height='150' alt='' /></a><br></li>";
}
?>
