TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,917
  • Total Topics: 21,308
  • Online today: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 1
  • Guests: 211
  • Total: 212
  • @rjen

[Block] Recent activity block for SMF Media Gallery

Started by zambo92, September 01, 2009, 01:23:46 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Freddy

#30
Thanks G6  :)

I will just add that this will work with other media as well, not just images.  Probably the best use of it is in a side block as it uses thumbnails.

zambo92

hey guys... i tried that code, but it only shows one of the things that are added, however could you make it so that it'll show the last 5 items that were added? because it just looks weird when there's one :S

Freddy

I'll pick this up again tomorrow as it's late here now.  Unless anyone else wants to take it up that is...fine by me.

JPDeni

It was just a little change so I went ahead and made it. I altered freddy's code to make the number of items to be selectable. You can set it from 1 to 100 or anywhere in between.

zambo92

where is the change you made?
it doesnt look any different... and if it is, what do i change to alter how many show?

zambo92

yes i saw the change you made, but can you make it so that the items are lined up horizontally rather than vertically? :P

JPDeni

Maybe you should decide what it is that you want -- the whole package -- so that whoever writes the code can make all the changes at once.

zambo92

well i know what i want, the code you changed was what i wanted however it caused them to line up vertically when i wanted them horizontally :P
could you just fix that please?

JPDeni

#38
Okay.



global $scripturl, $db_prefix;

$limit = 5; // Set how many you want to display here
// Grab the media details..
$request = db_query("
SELECT n.name, m.id_media, m.id_member, m.title, m.album_id, m.member_name, m.views
FROM {$db_prefix}mgallery_media m
INNER JOIN {$db_prefix}mgallery_albums n ON m.album_id = n.id_album
WHERE m.approved = 1
ORDER BY m.time_added DESC LIMIT $limit", __FILE__,__LINE__);
echo '<table><tr>';
while ($row = mysql_fetch_assoc($request)) {

// Output the item..
echo '
<td style="text-align:center">
<p style="margin:0px">
<a href="' , $scripturl , '?action=mgallery;sa=item;id=' , $row['id_media'] , '">' , $row['title'] , '</a><br />
<a href="' , $scripturl , '?action=mgallery;sa=item;id=' , $row['id_media'] , '"><img alt="" src="' , $scripturl . '?action=mgallery;sa=media;id=' , $row['id_media'] , ';thumb" /></a><br />
In : <a href="' , $scripturl , '?action=mgallery;sa=album;id=' , $row['album_id'] , '">' , $row['name'] , '</a><br />
Added by : <a href="' , $scripturl , '?action=profile;u=' , $row['id_member'] , '">' , $row['member_name'] , '</a><br />
' , $row['views'] , ($row['views'] == 1 ? ' view' : ' views') , '
</p>
</td>
';
}
echo '</tr></table>';
mysql_free_result($request);


zambo92

it came up with a syntax error when i inserted that

Parse error: syntax error, unexpected $end in /home/keisunet/public_html/Sources/Load.php(1754) : eval()'d code(48) : eval()'d code on line 30

This website is proudly hosted on Crocweb Cloud Website Hosting.