Displaying Recent Photos in Viewforum(Photoalbum)

Problems with forum installation, administration, moderation and other phpBB related support.

Moderator: Moderators

Displaying Recent Photos in Viewforum(Photoalbum)

Postby Jeane Paul on Sat Nov 11, 2006 11:11 am

hello guys,

Am quite having a headache here bout this add-on where i want to display my recent photos from my photo album to viewforum. i have no problem in the templates, just how to make my recent photos appear. here's the screenshot of my viewforum in my localhost

Image


furthermore, i searched for mod that can do that, and here's what i've found. yes it is for index page, but i want it too in my viewforum. can anyone tell me what to do. thanks

Code: Select all
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
#-----[ 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 ]------------------------------------------
#


i cant seem to find if i have skipped something there, but i still get no luck. any one help me here pls;

thanks in advance anyway, good day;
I'M WONDERING IF, MAYBE, THERE REALLY IS SOMETHING WRONG WITH ME." "EVERY ONCE IN AWHILE, THEY SAY THINGS THAT SOUND LIKE WORDS. THEY MAKE ME THINK ABOUT WHAT I'M DOING.

THE NOISES MAKE ME UNCOMFORTABLE."

================================
[Simple Forum]
User avatar
Jeane Paul
Registered User
Registered User
 
Posts: 363
Joined: Thu Feb 10, 2005 12:27 pm
Location: Manila, Phillipines

Postby Splinter on Sat Nov 11, 2006 12:14 pm

Hi,

Can't test it but will this work?

Code: Select all
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
#-----[ OPEN ]---------------------------------------------
#
viewforum.php

#
#-----[ FIND ]----------------------------------------
#
//
// End of forum prune
//
#
#-----[ AFTER 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("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id&amp;mark=topics"))

#
#-----[ 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']),
User avatar
Splinter
Coder
Coder
 
Posts: 483
Joined: Sun Feb 20, 2005 10:12 pm
Location: Nottingham, UK

Postby Jeane Paul on Sat Nov 11, 2006 12:40 pm

hello,


thanks for the help, but am sorry mate, it dint work. i got some errors in my browser

Code: Select all
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in W:\www\php\viewforum.php on line 497


as for line 497, this what in my editor shows

Code: Select all
    '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']),


still working on it,
I'M WONDERING IF, MAYBE, THERE REALLY IS SOMETHING WRONG WITH ME." "EVERY ONCE IN AWHILE, THEY SAY THINGS THAT SOUND LIKE WORDS. THEY MAKE ME THINK ABOUT WHAT I'M DOING.

THE NOISES MAKE ME UNCOMFORTABLE."

================================
[Simple Forum]
User avatar
Jeane Paul
Registered User
Registered User
 
Posts: 363
Joined: Thu Feb 10, 2005 12:27 pm
Location: Manila, Phillipines

Postby Splinter on Sat Nov 11, 2006 12:59 pm

Hi,

Sorry i'm stupid.... Thanks for pointing it out as usual useless! ;) try this:

Code: Select all
#
#-----[ FIND ]----------------------------------------
#
   'U_MARK_READ' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id&amp;mark=topics"))

#
#-----[ REPLACE WITH ]-----------------------------------
#

   'U_MARK_READ' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id&amp;mark=topics"),
   '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']))
User avatar
Splinter
Coder
Coder
 
Posts: 483
Joined: Sun Feb 20, 2005 10:12 pm
Location: Nottingham, UK

Postby Jeane Paul on Sat Nov 11, 2006 1:20 pm

Greetings,

Sweet, it workded like a charm thanks splinter. but, it only displays one pic only, what if i want it 2 or more pics to be displayed?
I'M WONDERING IF, MAYBE, THERE REALLY IS SOMETHING WRONG WITH ME." "EVERY ONCE IN AWHILE, THEY SAY THINGS THAT SOUND LIKE WORDS. THEY MAKE ME THINK ABOUT WHAT I'M DOING.

THE NOISES MAKE ME UNCOMFORTABLE."

================================
[Simple Forum]
User avatar
Jeane Paul
Registered User
Registered User
 
Posts: 363
Joined: Thu Feb 10, 2005 12:27 pm
Location: Manila, Phillipines

Postby Splinter on Sat Nov 11, 2006 1:24 pm

Hi,

it looks like the code limits it to 1. Try changing RAND() LIMIT 1
User avatar
Splinter
Coder
Coder
 
Posts: 483
Joined: Sun Feb 20, 2005 10:12 pm
Location: Nottingham, UK

Postby Jeane Paul on Sat Nov 11, 2006 2:28 pm

Greetings,

uhhm, am sorry, am not quite good in that, change that to what? should i replace this

Code: Select all
RAND() LIMIT 1

to
Code: Select all
RAND() LIMIT 4
I'M WONDERING IF, MAYBE, THERE REALLY IS SOMETHING WRONG WITH ME." "EVERY ONCE IN AWHILE, THEY SAY THINGS THAT SOUND LIKE WORDS. THEY MAKE ME THINK ABOUT WHAT I'M DOING.

THE NOISES MAKE ME UNCOMFORTABLE."

================================
[Simple Forum]
User avatar
Jeane Paul
Registered User
Registered User
 
Posts: 363
Joined: Thu Feb 10, 2005 12:27 pm
Location: Manila, Phillipines

Postby Splinter on Sat Nov 11, 2006 2:35 pm

Hi,

Unfortunately it won't work, you will need to create a loop for it to display more than one picture.
User avatar
Splinter
Coder
Coder
 
Posts: 483
Joined: Sun Feb 20, 2005 10:12 pm
Location: Nottingham, UK

Postby Jeane Paul on Sat Nov 11, 2006 2:39 pm

Greetings,

i thought so. thanks for the help btw. anyway, ill try to find better mods for that. am not satisfied with it. thanks again.
I'M WONDERING IF, MAYBE, THERE REALLY IS SOMETHING WRONG WITH ME." "EVERY ONCE IN AWHILE, THEY SAY THINGS THAT SOUND LIKE WORDS. THEY MAKE ME THINK ABOUT WHAT I'M DOING.

THE NOISES MAKE ME UNCOMFORTABLE."

================================
[Simple Forum]
User avatar
Jeane Paul
Registered User
Registered User
 
Posts: 363
Joined: Thu Feb 10, 2005 12:27 pm
Location: Manila, Phillipines

Postby Splinter on Sat Nov 11, 2006 2:44 pm

User avatar
Splinter
Coder
Coder
 
Posts: 483
Joined: Sun Feb 20, 2005 10:12 pm
Location: Nottingham, UK

Postby Jeane Paul on Sat Nov 11, 2006 2:48 pm

Greetings,

alright!, thanks. ill give it a try, be back soon.
I'M WONDERING IF, MAYBE, THERE REALLY IS SOMETHING WRONG WITH ME." "EVERY ONCE IN AWHILE, THEY SAY THINGS THAT SOUND LIKE WORDS. THEY MAKE ME THINK ABOUT WHAT I'M DOING.

THE NOISES MAKE ME UNCOMFORTABLE."

================================
[Simple Forum]
User avatar
Jeane Paul
Registered User
Registered User
 
Posts: 363
Joined: Thu Feb 10, 2005 12:27 pm
Location: Manila, Phillipines

Postby Jeane Paul on Sat Nov 11, 2006 9:02 pm

Greetings,

yes and it work very fine, thanks alot..i really appreciate that;
I'M WONDERING IF, MAYBE, THERE REALLY IS SOMETHING WRONG WITH ME." "EVERY ONCE IN AWHILE, THEY SAY THINGS THAT SOUND LIKE WORDS. THEY MAKE ME THINK ABOUT WHAT I'M DOING.

THE NOISES MAKE ME UNCOMFORTABLE."

================================
[Simple Forum]
User avatar
Jeane Paul
Registered User
Registered User
 
Posts: 363
Joined: Thu Feb 10, 2005 12:27 pm
Location: Manila, Phillipines


Return to phpBB Support

Who is online

Users browsing this forum: No registered users and 6 guests