Welcome to Geeklog, Anonymous Friday, November 29 2024 @ 10:42 am EST
Geeklog Forums
Filemgmt last 10 downloads?
d|gItaL
Anonymous
Has anyone wrote a block that displays latest X additions to the download database with a direct link to the file?
9
9
Quote
Status: offline
squatty
Forum User
Full Member
Registered: 01/21/02
Posts: 269
webCI
Anonymous
////////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/////////
13
18
Quote
All times are EST. The time is now 10:42 am.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content