Verfasst: 03.02.2004 23:41
portal.php:
suche:
füge davor ein:
Block für portal_body.tpl:
A.
suche:
Code: Alles auswählen
//
// Fetch Posts from Announcements Forum
//
Code: Alles auswählen
//
// Get Pics cat_id=1
//
include($album_root_path . 'album_common.'.$phpEx);
$cat_id = 1;
$start = 0;
$pics_per_page = 4;
$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, p.pic_lock, p.pic_approval, u.user_id, u.username
FROM ". ALBUM_TABLE ." AS p
LEFT JOIN ". USERS_TABLE ." AS u ON p.pic_user_id = u.user_id
WHERE p.pic_cat_id = '$cat_id'
GROUP BY p.pic_id
ORDER BY p.pic_time DESC
LIMIT 0,12";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not query pics information', '', __LINE__, __FILE__, $sql);
}
$picrow = array();
while( $row = $db->sql_fetchrow($result) )
{
$picrow[] = $row;
}
for ($i = 0; $i < count($picrow); $i += 3)
{
$template->assign_block_vars('picrow', array());
for ($j = $i; $j < ($i + 3); $j++)
{
if( $j >= count($picrow) )
{
break;
}
$template->assign_block_vars('picrow.piccol', array(
'U_PIC' => append_sid("album_page.$phpEx?pic_id=". $picrow[$j]['pic_id']),
'THUMBNAIL' => append_sid("album_thumbnail.$phpEx?pic_id=". $picrow[$j]['pic_id']),
'DESC' => $picrow[$j]['pic_desc'],
)
);
$pic_poster = '<a href="'. append_sid("profile.$phpEx?mode=viewprofile&". POST_USERS_URL .'='. $picrow[$j]['user_id']) .'">'. $picrow[$j]['username'] .'</a>';
$template->assign_block_vars('picrow.pic_detail', array(
'TITLE' => $picrow[$j]['pic_title'],
)
);
}
}
$sql = "SELECT count(pic_id) as entries
FROM ". ALBUM_TABLE . "
WHERE pic_cat_id = '$cat_id'";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not query total entries.', '', __LINE__, __FILE__, $sql);
}
$total = $db->sql_fetchrow($result);
$template->assign_vars(array(
'U_MORE_PICS_1' => ($total['entries'] > 4) ? '<a href="'. append_sid("album_cat.$phpEx?cat_id=". $cat_id) .'">'. $lang['more_pics'] .'</a>' : '',
));
Code: Alles auswählen
<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
<tr>
<td class="catHead" colspan="10" height="25" align="center"><span class="genmed"><b>Bilder</b></span></td>
</tr>
<!-- BEGIN no_pics -->
<tr>
<td class="row1" align="center" height="50"><span class="gen">{L_NO_PICS}</span></td>
</tr>
<!-- END no_pics -->
<!-- BEGIN picrow -->
<tr>
<!-- BEGIN piccol -->
<td align="center" width="{S_COL_WIDTH}" class="row1"><span class="genmed"><a href="{picrow.piccol.U_PIC}" {TARGET_BLANK}><img src="{picrow.piccol.THUMBNAIL}" border="0" alt="{picrow.piccol.DESC}" title="{picrow.piccol.DESC}" vspace="10" /></a><br />{picrow.piccol.APPROVAL}</span></td>
<!-- END piccol -->
</tr>
<tr>
<!-- BEGIN pic_detail -->
<td class="row2"><span class="gensmall">
{picrow.pic_detail.TITLE}<br />
</td>
<!-- END pic_detail -->
</tr>
<!-- END picrow -->
</td>
</tr>
<tr>
<td class="row1" colspan="10" height="25" align="center"><span class="nav">{U_MORE_PICS_1}</span></td>
</tr>
</table>