Has anyone wrote a block that displays latest X additions to the download database with a direct link to the file?
////////Start code///////
function phpblock_topdown()
{
global $LANG_FILEMGMT, $_FM_TABLES, $_CONF;
$stat_templates = new Template($_CONF['path_layout'] . 'stats');
$stat_templates->set_file(array('itemstats'=>'itemstatistics.thtml',
'statrow'=>'singlestat.thtml'));
if ($showsitestats == 1) {
} else {
$result = DB_query("SELECT lid, title, hits from {$_FM_TABLES['filemgmt_filedetail']} WHERE hits > 0 ORDER BY hits desc LIMIT 10"
;
$nrows = DB_numRows($result);
if ($nrows > 1) {
$stat_templates->set_var('item_label',"Last 10 Files"
;
$stat_templates->set_var('stat_name',"Hits"
;
for ($i = 0; $i < $nrows && $i < 10; $i++) {
list ($lid, $title,$hits) = DB_fetchARRAY($result);
$stat_templates->set_var('item_url', $_CONF[site_url]. "/filemgmt/singlefile.php?lid=".$lid);
$stat_templates->set_var('item_text', str_replace( '$', '$', substr( $title, 0, 19 ) ));
$stat_templates->set_var('item_stat', $hits);
$stat_templates->parse( 'stat_row', 'statrow', true );
}
$stat_templates->parse( 'output', 'itemstats' );
$retval .= $stat_templates->finish($stat_templates->get_var('output'));
} else {
}
}
return $retval;
}
////////end code/////////