by jomasaco on Sat Jan 23, 2010
Since i include one easy way to disable the module ($enablemod = true the entire table structure must be inside of module.
Code:
<?php
/*BEGIN_INFO
Show the top downloads by views.
By jomasaco www.stugas-ddl.org.
END_INFO*/
if(!defined("WCDDL_GUTS")) exit;
$enablemod = true; //change to false if you don't want to show
if($enablemod) {
$outa = '<table border="0" cellpadding="6" cellspacing="1" width="100%">
<thead>
<tr>
<th colspan="5">Top 10 Downloads</span></th>
</tr>
</thead>
<tbody>
<tr><td>Type</td><td>Title</td><td>Provider</td><td>Views</td><td>Rating</td></tr>';
$getit = mysql_query("SELECT id,sid,type,title,views,rating FROM wcddl_downloads WHERE views>0 ORDER BY views DESC LIMIT 0,10"); //change 10 to many you want
while ($got = mysql_fetch_array($getit)) {
$site = mysql_query("SELECT name as sname, url as surl from wcddl_sites WHERE id = '".$got['sid']."'");
$site = mysql_fetch_assoc($site);
$row = array_merge($site,$got);
$outa .= '<tr><td>'.$row['type'].'</td><td>'.$row['title'].'</td><td>'.$row['sname'].'</td><td>'.$row['views'].'</td><td>'.$row['rating'].'</td></tr>';
}
$outa .= '</tbody></table>';
$core->setTemplateVar("top10",$outa);
}
?>
display
Code:
<?=$core->templateVar("top10")?>