Seite 1 von 1

Bilder aus Sub-Kategorien in aktuelle öffentliche Bilder

Verfasst: 05.04.2005 14:50
von naptune
Hallo,

ich habe den Album Mod von Smartor und den "kleine" Sub-Kategorie´s Mod von Rhygin.

Das Problem: Die Bilder aus den Subkategorien werden nicht in die beiden Blöcke "letzte aktuelle Bilder" und "Bilder mit den meisten Kommentaren" mit einbezogen.

Weiß jemand wie man den Code ändern kann damit auch diese Bilder einbezogen werden?

THX

Verfasst: 05.04.2005 18:18
von naptune
hier noch die auszüge aus der album.php
+----------------------------------------------------------
| Recent Public Pics
+----------------------------------------------------------
*/

if ($allowed_cat != '')
{
$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_CAT_TABLE ." AS ct ON p.pic_cat_id = ct.cat_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 p.pic_cat_id IN ($allowed_cat) AND ( p.pic_approval = 1 OR ct.cat_approval = 0 )
GROUP BY p.pic_id
ORDER BY pic_time DESC
LIMIT ". $album_config['cols_per_page'];
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not query recent pics information', '', __LINE__, __FILE__, $sql);
}

$recentrow = array();

while( $row = $db->sql_fetchrow($result) )
{
$recentrow[] = $row;
}


if (count($recentrow) > 0)
{
for ($i = 0; $i < count($recentrow); $i += $album_config['cols_per_page'])
{
$template->assign_block_vars('recent_pics', array());

for ($j = $i; $j < ($i + $album_config['cols_per_page']); $j++)
{
if( $j >= count($recentrow) )
{
break;
}

if(!$recentrow[$j]['rating'])
{
$recentrow[$j]['rating'] = $lang['Not_rated'];
}
else
{
$recentrow[$j]['rating'] = round($recentrow[$j]['rating'], 2);
}

$template->assign_block_vars('recent_pics.recent_col', array(
'U_PIC' => ($album_config['fullpic_popup']) ? append_sid("album_pic.$phpEx?pic_id=". $recentrow[$j]['pic_id']) : append_sid("album_page.$phpEx?pic_id=". $recentrow[$j]['pic_id']),
'THUMBNAIL' => append_sid("album_thumbnail.$phpEx?pic_id=". $recentrow[$j]['pic_id']),
'DESC' => $recentrow[$j]['pic_desc']
)
);

if( ($recentrow[$j]['user_id'] == ALBUM_GUEST) or ($recentrow[$j]['username'] == '') )
{
$recent_poster = ($recentrow[$j]['pic_username'] == '') ? $lang['Guest'] : $recentrow[$j]['pic_username'];
}
else
{
$recent_poster = '<a href="'. append_sid("profile.$phpEx?mode=viewprofile&". POST_USERS_URL .'='. $recentrow[$j]['user_id']) .'">'. $recentrow[$j]['username'] .'</a>';
}

$template->assign_block_vars('recent_pics.recent_detail', array(
'TITLE' => $recentrow[$j]['pic_title'],
'POSTER' => $recent_poster,
'TIME' => create_date($board_config['default_dateformat'], $recentrow[$j]['pic_time'], $board_config['board_timezone']),

'VIEW' => $recentrow[$j]['pic_view_count'],

'RATING' => ($album_config['rate'] == 1) ? ( '<a href="'. append_sid("album_rate.$phpEx?pic_id=". $recentrow[$j]['pic_id']) . '">' . $lang['Rating'] . '</a>: ' . $recentrow[$j]['rating'] . '<br />') : '',

'COMMENTS' => ($album_config['comment'] == 1) ? ( '<a href="'. append_sid("album_comment.$phpEx?pic_id=". $recentrow[$j]['pic_id']) . '">' . $lang['Comments'] . '</a>: ' . $recentrow[$j]['comments'] . '<br />') : '',

'IP' => ($userdata['user_level'] == ADMIN) ? $lang['IP_Address'] . ': <a href="http://www.nic.com/cgi-bin/whois.cgi?query=' . decode_ip($recentrow[$j]['pic_user_ip']) . '" target="_blank">' . decode_ip($recentrow[$j]['pic_user_ip']) .'</a><br />' : ''
)
);
}
}
}
else
{
//
// No Pics Found
//
$template->assign_block_vars('no_pics', array());
}
}
else
{
//
// No Cats Found
//
$template->assign_block_vars('no_pics', array());
}
und wie die datenbank aussieht:

[ externes Bild ]


vielleicht kann mir ja so jemand weiterhelfen :(