TinyPortal

Development => Block Codes => Topic started by: fussilet on July 20, 2008, 09:36:56 PM

Title: [block] Total Download for Smf Download System
Post by: fussilet on July 20, 2008, 09:36:56 PM
Thanks Husmen[aslanbeg]

The block form, add into

demo: www.fussilet.com

global $db_prefix, $scripturl;

$request = db_query("SELECT f.ID_FILE, f.ID_MEMBER, f.date, f.ID_CAT, f.title AS ftitle, f.totaldownloads,
c.title, m.realName, m.ID_MEMBER AS mID_MEMBER
FROM {$db_prefix}down_file AS f, {$db_prefix}down_cat AS c, {$db_prefix}members AS m
WHERE f.ID_CAT = c.ID_CAT
AND f.approved = '1'
AND f.ID_MEMBER = m.ID_MEMBER
ORDER BY totaldownloads DESC
LIMIT 10",__FILE__,__LINE__);
while($row = mysql_fetch_assoc($request)) {
echo '<table width="100%" cellpadding="2" cellspacing="0">
<tr>
<td valign="top" class="smalltext"> <a href="',$scripturl,'?action=downloads;sa=view;id=',$row['ID_FILE'],'">',$row['ftitle'],'</a></td>
<td valign="top" class="smalltext" align="right">',$row['totaldownloads'],'</td>
</tr>
</table>';
}
Title: Re: [block] Total Download for Smf Download System
Post by: bbTURK on July 20, 2008, 09:41:45 PM
thanks fussilet
thanks Husmen


can we not see downloads screen?
Title: Re: [block] Total Download for Smf Download System
Post by: fussilet on July 20, 2008, 09:42:40 PM
I thanks bro :)
Title: Re: [block] Total Download for Smf Download System
Post by: NIBOGO on July 26, 2008, 11:43:37 PM
really nice thanks ^^

how i can do something like this:

(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fimg205.imageshack.us%2Fimg205%2F8584%2Ficydv3.gif&hash=40a7c88a04fbcf54ff40a98966a465347ebd9b09)

I try this code:

echo '<table bgcolor="#DFE2E6" width="100%">
  <tr>
    <td colspan="2">Top 10 Nuevas Descargas</td>
    <td colspan="2">Top 10 Mas Descargadas</td>   
  </tr><br>';
global $db_prefix, $scripturl;
$request = db_query("SELECT f.ID_FILE, f.ID_MEMBER, f.date, f.ID_CAT, f.title AS ftitle, f.totaldownloads,
c.title, m.realName, m.ID_MEMBER AS mID_MEMBER
FROM {$db_prefix}down_file AS f, {$db_prefix}down_cat AS c, {$db_prefix}members AS m
WHERE f.ID_CAT = c.ID_CAT
AND f.approved = '1'
AND f.ID_MEMBER = m.ID_MEMBER
ORDER BY f.ID_FILE DESC
LIMIT 5",__FILE__,__LINE__);
while($row = mysql_fetch_assoc($request)) {
echo '
<tr>
<td class="smalltext"><a href="',$scripturl,'?action=view;id=',$row['ID_FILE'],'">',$row['ftitle'],'</a></td>
<td class="smalltext" >',$row['totaldownloads'],'</td>
';
}

global $db_prefix, $scripturl;

$request = db_query("SELECT f.ID_FILE, f.ID_MEMBER, f.date, f.ID_CAT, f.title AS ftitle, f.totaldownloads,
c.title, m.realName, m.ID_MEMBER AS mID_MEMBER
FROM {$db_prefix}down_file AS f, {$db_prefix}down_cat AS c, {$db_prefix}members AS m
WHERE f.ID_CAT = c.ID_CAT
AND f.approved = '1'
AND f.ID_MEMBER = m.ID_MEMBER
ORDER BY totaldownloads DESC
LIMIT 5",__FILE__,__LINE__);
while($row = mysql_fetch_assoc($request)) {
echo '
<td class="smalltext"><a href="',$scripturl,'?action=downloads;sa=view;id=',$row['ID_FILE'],'">',$row['ftitle'],'</a></td>
<td class="smalltext" >',$row['totaldownloads'],'</td>
</tr>';
}
echo '</table>';


But i have some errors , someone can make something?
Title: Re: [block] Total Download for Smf Download System
Post by: Dragooon on August 08, 2008, 08:22:50 AM
Although quite a old topic, I thought I might post this(This is totally untested, *hopes it works*).
Based on NIBIGO's request
echo '<table bgcolor="#DFE2E6" width="100%">
  <tr>
    <td>Top 10 Nuevas Descargas</td>
    <td>Top 10 Mas Descargadas</td>   
  </tr>';
global $db_prefix, $scripturl;
$latest = array();
$top = array();
$request = db_query("SELECT f.ID_FILE, f.ID_MEMBER, f.date, f.ID_CAT, f.title AS ftitle, f.totaldownloads,
c.title, m.realName, m.ID_MEMBER AS mID_MEMBER
FROM {$db_prefix}down_file AS f, {$db_prefix}down_cat AS c, {$db_prefix}members AS m
WHERE f.ID_CAT = c.ID_CAT
AND f.approved = '1'
AND f.ID_MEMBER = m.ID_MEMBER
ORDER BY f.ID_FILE DESC
LIMIT 5",__FILE__,__LINE__);
while($row = mysql_fetch_assoc($request)) {
$latest[] = '<a href="'.$scripturl.'?action=view;id='.$row['ID_FILE'].'">'.$row['ftitle'].'</a> ('.timeformat($row['data']).')';
}

$request = db_query("SELECT f.ID_FILE, f.ID_MEMBER, f.date, f.ID_CAT, f.title AS ftitle, f.totaldownloads,
c.title, m.realName, m.ID_MEMBER AS mID_MEMBER
FROM {$db_prefix}down_file AS f, {$db_prefix}down_cat AS c, {$db_prefix}members AS m
WHERE f.ID_CAT = c.ID_CAT
AND f.approved = '1'
AND f.ID_MEMBER = m.ID_MEMBER
ORDER BY totaldownloads DESC
LIMIT 5",__FILE__,__LINE__);
while($row = mysql_fetch_assoc($request)) {
$top[] = '<a href="'.$scripturl.'?action=downloads;sa=view;id='.$row['ID_FILE'].'">'.$row['ftitle'].'</a> ('.timeformat($row['data']).')';
}

$max_count = max(array(count($top), count($latest)));
for($i = 0; $i < $max_count; $i ++);
{
echo '<tr><td>',isset($top[$i]) ? $top[$i] : '','</td></tr>';
echo '<tr><td>',isset($latest[$i]) ? $latest[$i] : '','</td></tr>';
}
echo '
</table>';
Title: Re: [block] Total Download for Smf Download System
Post by: NIBOGO on August 09, 2008, 02:30:02 AM
Thanks dragooon but i have this error:

Parse error: syntax error, unexpected ';', expecting ')' on line 34
Title: Re: [block] Total Download for Smf Download System
Post by: Dragooon on August 09, 2008, 05:54:31 AM
Updated the code, try that.
Title: Re: [block] Total Download for Smf Download System
Post by: fussilet on August 11, 2008, 09:44:16 PM
thanks Sir ;)
Title: Re: [block] Total Download for Smf Download System
Post by: dannbass on August 12, 2008, 01:56:43 AM
I got the same error in the updated code Dragoon

Line 34
for($i = 0; $i < $max_count; $i ++;
should be
for($i = 0; $i < $max_count; $i ++);

Thanks for the code!
Title: Re: [block] Total Download for Smf Download System
Post by: Dragooon on August 12, 2008, 09:54:28 AM
Yeah you are right, fixed my post, thanks :)
Title: Re: [block] Total Download for Smf Download System
Post by: NIBOGO on August 13, 2008, 03:09:14 AM
I try the new code but i only see a table with the "Top 10 Nuevas Descargas"
and "Top 10 Mas Descargadas " i dont see any download

Thanks
Title: Re: [block] Total Download for Smf Download System
Post by: Dragooon on August 13, 2008, 10:29:21 AM
Are you trying this with TP's download manager or the mod SMF Downloads, because its for SMF Downloads.
Title: Re: [block] Total Download for Smf Download System
Post by: NIBOGO on August 17, 2008, 03:01:17 AM
Quote from: Dragooon on August 13, 2008, 10:29:21 AM
Are you trying this with TP's download manager or the mod SMF Downloads, because its for SMF Downloads.

SMF Downloads
Title: Re: [block] Total Download for Smf Download System
Post by: vortodox on September 19, 2008, 09:59:16 AM
Is it posible to make a block only with recently added downloads?
Title: Re: [block] Total Download for Smf Download System
Post by: IchBin on September 20, 2008, 12:38:10 AM
TP 0.9.8 has this already built in.
Title: Re: [block] Total Download for Smf Download System
Post by: vortodox on September 20, 2008, 09:44:25 AM
I was talking about Smf Download System...
Title: Re: [block] Total Download for Smf Download System
Post by: G6Cad on September 20, 2008, 10:10:00 AM
The best answers to make a block for that system is to ask the one that made the mod for SMF,