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: 210
  • Total: 211
  • @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.

zambo92

CODE made by freddy888 added here to first post.

This initial code will provide the most recent thumbnail and details of the latest entry in mgallery.  It is most suitable for a side block in this form.  This will also work with other media such as mp3 as it uses the inbuilt thumbnails.

If you want a bigger block with more than one recent item then jump ahead to where JPDeni has modified the initial code here... which will show as many items as you want horizontally.


global $scripturl, $db_prefix;

// 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 1", __FILE__,__LINE__);

$row = mysql_fetch_assoc($request);

// Output the item..
echo '
<div 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>
</div>
';

mysql_free_result($request);


Let me know how you get on :)

---------------------------------------------------------------------------------------------------------------------------------------------

hey guys, i added tp to my forums and its really awesome... however, i made a block at the top of the page, and im trying to make it so that whenever somebody adds something new to my gallery (online anime streaming done there), it'll show it in that block.... how can i do that?

my site is hxxp://keishou.net

Zetan

Hi zambo92, welcome to TinyPortal. Before we can offer any advice, we need you to read the and follow Posting Guidelines.html.

It would also help if you told us what gallery you are using.
There is a Random Gallery block in the Block Code Snippets board:
http://www.tinyportal.net/index.php/board,46.0.html

Lastly, if you are using a gallery we are unfamiliar with, we need to see the code and any other information.

zambo92

this is the gallery i am using :)

SMF Media Gallery 2.0 beta 4

Zetan

Did you look in the Snippets Board?

zambo92

yes but that code doesnt work
check my site out: hxxp://keishou.net

Zetan

What sort of address is hxxp://?

I've moved this to Snippet Requests.

Freddy

I can take a look at this....got visitors in a little while, so don't expect a sudden solution, this needs to be figured out from scratch.  But I am a little familiar with mgallery and have it on a test site.

Like Zetan says you really need to provide more information.

Zetan


zambo92

its http but i thought thats how it was supposed to be said on here :$

anyway, what kind of information do you need coz i can supply you with it :)

my website is http://keishou.net

Zetan

Quote from: zambo92 on September 01, 2009, 02:48:50 PM
its http but i thought thats how it was supposed to be said on here :$


Why would you think that? Never mind. Carry on.

This website is proudly hosted on Crocweb Cloud Website Hosting.