#################################################################
## Title: Smartor Album Add-On: Random or Recent Photo (phpBB 2.0.4)
## Author: SeekIdeas <cfsilent@yahoo.com>
## Demo: http://www.seekideas.com/
## Description: Display a random or recent photo on your forum main page
## or chosen from a category only.
##
## * NOTE: This mod only works for Smartor's excellent "Photo Album Addon v2"
## Download here - http://smartor.is-root.com/viewtopic.php?t=2473
##
## Files To Edit: 3
## index.php
## templates/subSilver/index_body.tpl
## language/lang_english/lang_main.php
##
#################################################################
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
#-----[ OPEN ]---------------------------------------------
#
index.php
#
#-----[ FIND ]----------------------------------------
#
if ( !($total_forums = count($forum_data)) )
{
message_die(GENERAL_MESSAGE, $lang['No_forums']);
}
#
#-----[ BEFORE ADD ]-----------------------------------
#
//
// BEGIN Random or Recent Photo
//
$Display = 'XXXX'; // Replace 'XXXX' with 'Recent' or 'Random'.
$CategoryID = 0; // Replace 0 with a category ID. Otherwise, keep it as it is.
// Example: http://www.seekideas.com/forum/album_cat.php?cat_id=3
// Category ID is 3
if ($Display == 'Random') {
if ($CategoryID != 0) {
$sql = "SELECT * FROM phpbb_album WHERE pic_cat_id = $CategoryID ORDER BY RAND() LIMIT 1";
}
else {
$sql = "SELECT * FROM phpbb_album ORDER BY RAND() LIMIT 1";
}
}
else if ($Display == 'Recent') {
if ($CategoryID != 0) {
$sql = "SELECT pic_id, pic_title, pic_username, pic_time FROM phpbb_album WHERE pic_cat_id = $CategoryID ORDER BY pic_time DESC LIMIT 0,1";
}
else {
$sql = "SELECT pic_id, pic_title, pic_username, pic_time FROM phpbb_album ORDER BY 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);
//
// END Random or Recent Photo
//
#
#-----[ FIND ]----------------------------------------
#
'U_MARK_READ' => append_sid("index.$phpEx?mark=forums"))
#
#-----[ AFTER ADD ]-----------------------------------
#
// Photo Album
'L_NEWEST_PIC' => $lang['Newest_pic'],
'PIC_IMAGE' => append_sid('album_thumbnail.'. $phpEx . '?pic_id=' . $picrow['pic_id']),
'PIC_TITLE' => $picrow['pic_title'],
'PIC_POSTER' => $picrow['pic_username'],
'U_PIC_LINK' => append_sid('album_comment.' . $phpEx . '?pic_id=' . $picrow['pic_id']),
'PIC_TIME' => create_date($board_config['default_dateformat'], $picrow['pic_time'], $board_config['board_timezone']),
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
#-----[ OPEN ]---------------------------------------------
#
templates/subSilver/index_body.tpl
#
#-----[ ADD ]-----------------------------------
#
//
// Place this anywhere in template file.
//
<table width="100%" cellpadding="3" cellspacing="1" border="0" align="center" class="forumline">
<tr>
<th class="catleft" colspan="2" height="22" align="left"><span class="thCornerL"> {L_NEWEST_PIC}</a></span></th>
</tr>
<tr>
<td class="row1" width="100%">
<span class="gensmall" style="line-height:150%"><br /><center><a href="{U_PIC_LINK}"><img src="{PIC_IMAGE}" border="0" alt="{L_NEWEST_PIC}"></a><br /><br /></span>
</td>
</tr>
<tr>
<td class="row1" width="100%">
<span class="gensmall" style="line-height:150%"><b>{PIC_TITLE}</b> by <b>{PIC_POSTER}</b><br />{PIC_TIME}</span>
</td>
</tr>
<tr>
<td class="row1" width="100%">
<span class="gensmall">[ <a href="{U_ALBUM}">{L_ALBUM}</a> ]</span>
</td>
</tr>
</table>
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
#-----[ OPEN ]---------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]----------------------------------------
#
$lang['No_poll'] = 'No poll at the moment';
#
#-----[ AFTER ADD ]-----------------------------------
#
# The name of your photo display
# Example: $lang['Newest_pic'] = 'Newest Photo';
# $lang['Newest_pic'] = 'HOTTEST PICTURE';
# $lang['Newest_pic'] = 'Random Pic';
$lang['Newest_pic'] = 'Recent Photo';
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
## Title: Smartor Album Add-On: Random or Recent Photo (phpBB 2.0.4)
## Author: SeekIdeas <cfsilent@yahoo.com>
## Demo: http://www.seekideas.com/
## Description: Display a random or recent photo on your forum main page
## or chosen from a category only.
##
## * NOTE: This mod only works for Smartor's excellent "Photo Album Addon v2"
## Download here - http://smartor.is-root.com/viewtopic.php?t=2473
##
## Files To Edit: 3
## index.php
## templates/subSilver/index_body.tpl
## language/lang_english/lang_main.php
##
#################################################################
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
#-----[ OPEN ]---------------------------------------------
#
index.php
#
#-----[ FIND ]----------------------------------------
#
if ( !($total_forums = count($forum_data)) )
{
message_die(GENERAL_MESSAGE, $lang['No_forums']);
}
#
#-----[ BEFORE ADD ]-----------------------------------
#
//
// BEGIN Random or Recent Photo
//
$Display = 'XXXX'; // Replace 'XXXX' with 'Recent' or 'Random'.
$CategoryID = 0; // Replace 0 with a category ID. Otherwise, keep it as it is.
// Example: http://www.seekideas.com/forum/album_cat.php?cat_id=3
// Category ID is 3
if ($Display == 'Random') {
if ($CategoryID != 0) {
$sql = "SELECT * FROM phpbb_album WHERE pic_cat_id = $CategoryID ORDER BY RAND() LIMIT 1";
}
else {
$sql = "SELECT * FROM phpbb_album ORDER BY RAND() LIMIT 1";
}
}
else if ($Display == 'Recent') {
if ($CategoryID != 0) {
$sql = "SELECT pic_id, pic_title, pic_username, pic_time FROM phpbb_album WHERE pic_cat_id = $CategoryID ORDER BY pic_time DESC LIMIT 0,1";
}
else {
$sql = "SELECT pic_id, pic_title, pic_username, pic_time FROM phpbb_album ORDER BY 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);
//
// END Random or Recent Photo
//
#
#-----[ FIND ]----------------------------------------
#
'U_MARK_READ' => append_sid("index.$phpEx?mark=forums"))
#
#-----[ AFTER ADD ]-----------------------------------
#
// Photo Album
'L_NEWEST_PIC' => $lang['Newest_pic'],
'PIC_IMAGE' => append_sid('album_thumbnail.'. $phpEx . '?pic_id=' . $picrow['pic_id']),
'PIC_TITLE' => $picrow['pic_title'],
'PIC_POSTER' => $picrow['pic_username'],
'U_PIC_LINK' => append_sid('album_comment.' . $phpEx . '?pic_id=' . $picrow['pic_id']),
'PIC_TIME' => create_date($board_config['default_dateformat'], $picrow['pic_time'], $board_config['board_timezone']),
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
#-----[ OPEN ]---------------------------------------------
#
templates/subSilver/index_body.tpl
#
#-----[ ADD ]-----------------------------------
#
//
// Place this anywhere in template file.
//
<table width="100%" cellpadding="3" cellspacing="1" border="0" align="center" class="forumline">
<tr>
<th class="catleft" colspan="2" height="22" align="left"><span class="thCornerL"> {L_NEWEST_PIC}</a></span></th>
</tr>
<tr>
<td class="row1" width="100%">
<span class="gensmall" style="line-height:150%"><br /><center><a href="{U_PIC_LINK}"><img src="{PIC_IMAGE}" border="0" alt="{L_NEWEST_PIC}"></a><br /><br /></span>
</td>
</tr>
<tr>
<td class="row1" width="100%">
<span class="gensmall" style="line-height:150%"><b>{PIC_TITLE}</b> by <b>{PIC_POSTER}</b><br />{PIC_TIME}</span>
</td>
</tr>
<tr>
<td class="row1" width="100%">
<span class="gensmall">[ <a href="{U_ALBUM}">{L_ALBUM}</a> ]</span>
</td>
</tr>
</table>
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
#-----[ OPEN ]---------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]----------------------------------------
#
$lang['No_poll'] = 'No poll at the moment';
#
#-----[ AFTER ADD ]-----------------------------------
#
# The name of your photo display
# Example: $lang['Newest_pic'] = 'Newest Photo';
# $lang['Newest_pic'] = 'HOTTEST PICTURE';
# $lang['Newest_pic'] = 'Random Pic';
$lang['Newest_pic'] = 'Recent Photo';
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
