HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media


Welcome to TinyPortal. Please login or sign up.

September 21, 2023, 08:08:54 PM

Login with username, password and session length
  • Total Posts: 194,530
  • Total Topics: 21,180
  • Online today: 97
  • Online ever: 3,540
  • (September 03, 2022, 01:38:54 AM)
Users Online
Users: 1
Guests: 79
Total: 80

[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.


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>