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

Recent

Welcome to TinyPortal. Please login or sign up.

April 19, 2024, 08:30:19 AM

Login with username, password and session length
Members
  • Total Members: 3,885
  • Latest: Growner
Stats
  • Total Posts: 195,164
  • Total Topics: 21,219
  • Online today: 266
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 98
  • Total: 98

[Block] Random Download Block

Started by IchBin, June 28, 2008, 04:19:32 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

IchBin

This should display a random item from the downloads manager in TP.

Sorry about all the inline CSS but I didn't feel like putting it anywhere else... :)



global $scripturl;

$tp_prefix = $settings['tp_prefix'];

$request = db_query("SELECT * FROM {$tp_prefix}dlmanager
WHERE type = 'dlitem' ORDER BY rand() LIMIT 1", __FILE__, __LINE__);

$row = mysql_fetch_array($request);

echo '
<ul style="padding: 0; list-style-type: none;">
<li><a href="', $scripturl ,'?action=tpmod;dl=get', $row['id'] ,'"><img src="', $row['icon'],'" /></a></li>
<li><b><a href="', $scripturl ,'?action=tpmod;dl=get', $row['id'] ,'">', $row['name'] ,'</a></b></li>
<li style="font-size: x-small"><hr />Uploaded:</li>
<li style="font-size: x-small"><i>', timeformat($row['created']) ,'</i></li>
<li style="font-size: x-small">Downloads: <b>', $row['downloads'] ,'</b></li>
<li style="font-size: x-small">Views: <b>', $row['views'] ,'</b></li>
</ul>';