Ok.. versuch´s ma mit dem folgenden. Ich konnte es natürlich nicht 100%ig testen, da mir einige Einstellungen fehlten etc.
index.php
ersetze den bisherigen Code mit..
Code: Alles auswählen
// Get Newest Pic
$sql = "SELECT * FROM ". ALBUM_CONFIG_TABLE;
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Could not query album config information.", "", __LINE__, __FILE__, $sql);
}
while( $row = $db->sql_fetchrow($result) )
{
$album_config_name = $row['config_name'];
$album_config_value = $row['config_value'];
$album_config[$album_config_name] = $album_config_value;
}
$sql = "SELECT p.pic_id, p.pic_title, p.pic_desc, p.pic_user_id, p.pic_user_ip, p.pic_username, p.pic_time, p.pic_cat_id, p.pic_view_count, u.user_id, u.username, r.rate_pic_id, AVG(r.rate_point) AS rating, COUNT(DISTINCT c.comment_id) AS comments
FROM ". ALBUM_TABLE ." AS p
LEFT JOIN ". USERS_TABLE ." AS u ON p.pic_user_id = u.user_id
LEFT JOIN ". ALBUM_RATE_TABLE ." AS r ON p.pic_id = r.rate_pic_id
LEFT JOIN ". ALBUM_COMMENT_TABLE ." AS c ON p.pic_id = c.comment_pic_id
WHERE pic_approval = 1
GROUP BY p.pic_id ORDER BY pic_time DESC LIMIT 3";
if (!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not query album information.', '', __LINE__, __FILE__, $sql);
}
while ( $picrow = $db->sql_fetchrow($result) )
{
if(!$picrow['rating'])
{
$picrow['rating'] = $lang['Not_rated'];
}
else
{
$picrow['rating'] = round($picrow['rating'], 2);
}
$pic_poster = '<a href="'. append_sid("profile.$phpEx?mode=viewprofile&". POST_USERS_URL .'='. $picrow['pic_user_id']) .'">'. $picrow['pic_username'] .'</a>';
$template->assign_block_vars('albumrow', array(
'L_NEWEST_PIC' => $lang['Newest_pic'],
'PIC_IMAGE' => append_sid('album_thumbnail.'. $phpEx . '?pic_id=' . $picrow['pic_id']),
'U_PIC_LINK' => append_sid('album_page.' . $phpEx . '?pic_id=' . $picrow['pic_id']),
'L_PIC_TITLE' => $lang['Pic_Title'],
'L_VIEW' => $lang['View'],
'L_POSTER' => $lang['Poster'],
'L_POSTED' => $lang['Posted'],
'L_RATING' => $lang['Rating'],
'TITLE' => stripslashes($picrow['pic_title']),
'POSTER' => $picrow['username'],
'PIC_POSTER' => $pic_poster,
'TIME' => create_date($board_config['default_dateformat'], $picrow['pic_time'], $board_config['board_timezone']),
'VIEW' => $picrow['pic_view_count'],
'RATING' => ($album_config['rate'] == 1) ? ( '<a href="'. append_sid("album_rate.$phpEx?pic_id=". $picrow['pic_id']) . '">' . $lang['Rating'] . '</a> : ' . $picrow['rating'] . '<br />') : '',
'COMMENTS' => ($album_config['comment'] == 1) ? ( '<a href="'. append_sid("album_comment.$phpEx?pic_id=". $picrow['pic_id']) . '">' . $lang['Comments'] . '</a> : ' . $picrow['comments'] . '<br />') : '',
));
}
// END - Get Newest Pic
index_body.tpl
lösche den bisherigen Code und füge folgendes als neue Tabelle ein (muss natürlich nicht unbedingt eine neue Tabelle sein)
Code: Alles auswählen
<table border="0" align="center" cellspacing="1" cellpadding="1" class="forumline" width="100%">
<tr>
<!-- BEGIN albumrow -->
<td align="left" valign="top" class="row2">
<table border="0" align="center" cellspacing="1" cellpadding="1">
<tr>
<td><span class="gensmall" style="line-height:150%"><a href="{albumrow.U_PIC_LINK}"><img src="{albumrow.PIC_IMAGE}" border="0"></a></span></td>
<td><span class="gensmall">
{albumrow.L_PIC_TITLE}: {albumrow.TITLE}<br />
{albumrow.L_POSTER}: <b>{albumrow.PIC_POSTER}</b><br />
{albumrow.L_POSTED}: {albumrow.TIME}<br />
{albumrow.L_RATING}{albumrow.RATING}
{albumrow.L_VIEW}: {albumrow.VIEW}</span></td>
</tr>
<tr>
<td align="center" colspan="2"><span class="gensmall">{albumrow.COMMENTS}</span></td>
</tr>
</table></td>
<!-- END albumrow -->
</tr>
<tr>
<td align="center" class="row1" colspan="4"><span class="gensmall">[ <a href="{U_ALBUM}">{L_ALBUM}</a> ] </span></td>
</tr>
</table>