Probiers mal hiermit:
Index.php:
Code: Alles auswählen
// Recent Pics please select sort by
$sortby = 'last_pic' ; // Sort By Last Pic
//$sortby = 'good_rate' ; // Sort by Good Average Vote
//$sortby = 'time_rate' ; // Sort By rating et Last Time
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 " . phpbb_album . " 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 ";
if ($sortby == "last_pic") {
$sql .= " ORDER BY pic_time DESC LIMIT 0,1";
}
if ($sortby == "good_rate") {
$sql .= " ORDER BY rating DESC LIMIT 0,1";
}
if ($sortby == "time_rate") {
$sql .= " ORDER BY rating DESC,pic_time DESC LIMIT 0,1";
}
if (!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not query album information', '', __LINE__, __FILE__, $sql);
}
$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>';
// END - Get Newest Pic
Code: Alles auswählen
// Photo Album
'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 Photo Album
Index_body.tpl:
Code: Alles auswählen
<tr>
<td class="row1" align="left"><span class="gensmall" style="line-height:150%"><center>
<a href="{U_PIC_LINK}"><img src="{PIC_IMAGE}" border="0"></a><br />
</span></td>
</tr>
<tr>
<td align="left" valign="top" class="row2"><span class="gensmall">
{L_PIC_TITLE}: {TITLE}<br />
{L_POSTER}: <b>{PIC_POSTER}</b><br />
{L_POSTED}: {TIME}<br /></span></td>
</tr>
<tr>
<td align="center" class="row2"><span class="gensmall">[ <a href="{U_ALBUM}">{L_ALBUM}</a> ]<br /> </span></td>
</tr>
Ist so bei mir in der portal.php / portal_body.tpl.
Als Anhang mal meine portal.php:
http://www.retriever-hilfe.de/forum/portal.php.txt. Vielleicht hilft´s!
Andreas