[WCDDL] Top Downloads by Category

Status
Not open for further replies.

jomasaco

Active Member
192
2008
21
0
65048p.png


Code:
<?php
/*BEGIN_INFO
Use this module to Create an page whit the top downloads for each category<br />.
By Stugas-ddl.org
END_INFO*/
if(!defined("WCDDL_GUTS"))
   exit;
    foreach($core->allowed_types as $ty) {
    $output .= '<table width="100%" border="0"><tr  class="row2">
    <td><font size="4">Top 10 <span class="'.strtolower($ty).'">'.ucfirst($ty).'</span> Downloads</font></td>
    </tr>';
    $dbc = mysql_query("SELECT id,title,dat FROM wcddl_downloads WHERE type = '".$ty."' ORDER BY views DESC LIMIT 10");
        while($row = mysql_fetch_assoc($dbc))
        $output .= '<tr class="row2"><td><font size="2" color="red"><a href="/?q='.$row['title'].'" target="_blank">'.$row['title'].'</a></font></a></td>
        <td>'.date("d-m-Y",$row['dat']).'</td></tr>';
    $output .= '</table><br>';
    }
$core->setTemplateVar("downloadsbycategory",$output);
?>
Code:
<?=$core->templateVar("downloadsbycategory")?>
 
5 comments
Here's a more optimized version.

PHP:
<?php
/*BEGIN_INFO
Use this module to Create an page whit the top downloads for each category<br />.
By Stugas-ddl.org
END_INFO*/
if(!defined('WCDDL_GUTS')) exit;
foreach($core->allowed_types as $ty) {
    $output .= '<table width="100%" border="0"><tr><td><font size="4">Top 10 '.ucfirst($ty).' Downloads</font></td></tr>';
    $dbc = mysql_query('SELECT id,title,dat FROM wcddl_downloads WHERE type = \''.$ty.'\' ORDER BY views DESC LIMIT 10');
    while($row = mysql_fetch_assoc($dbc)) $output .= '<tr><td><font size="2" color="red"><a href="/?q='.$row['title'].'" target="_blank">'.$row['title'].'</a></font></a></td><td>'.date('d-m-Y',$row['dat']).'</td></tr>';
    $output .= '</table><br />';
}
$core->setTemplateVar('downloadsbycategory',$output);
?>
 
were do u add the second code this :
<?=$core->templateVar("downloadsbycategory")?>

do u add it to index.php or left bar.php were do u add this code ?
 
Mac-That is what displays the the top downloads...you put that code where you want the top downloads to display. Usually a seperate page like index.php but a different name like topdownloads.php. You have to make the topdownload.php but can use the index.php or whatever page as a general guide.
 
Status
Not open for further replies.
Back
Top