Welcome to Geeklog, Anonymous Wednesday, November 27 2024 @ 04:34 pm EST
Geeklog Forums
Top downloads for downloads plugin
Status: offline
::Ben
Forum User
Full Member
Registered: 01/14/05
Posts: 1569
Location:la rochelle, France
Tested with downloads plugin 1.0.4. Demo at the bottom of this page.
function phpblock_topdownloads()
{
global $_CONF, $_TABLES, $_USER;
//set limit here
$limit = 10;
$poplist = '';
$query = "SELECT f.* FROM {$_TABLES['downloads']} AS f
LEFT JOIN {$_TABLES['downloadcategories']} AS c
ON c.cid = f.cid
";
$query .= COM_getPermSQL('WHERE', 0, 2, 'c' );
$query .= " ORDER BY hits DESC LIMIT {$limit}";
$result = DB_query($query);
$nrows = DB_numRows($result);
if( $nrows > 0 ){
$string = '';
$popular = array();
for( $i = 0; $i < $nrows; $i++ ){
$A = DB_fetchArray( $result );
$string .= $poplist . '';
$popular[] = '<a href="' . $_CONF['site_url']
. '/downloads/index.php?id=' . $A['lid'] . '">' . $A['title']
. '</a> (' . $A['hits'] . ')';
}
if( !empty( $popular )){
$poplist = COM_makeList( $popular, 'list-popular-stories' );
}
}
if ($poplist == '') $poplist = 'Sorry, there is no available data.';
return $poplist;
}
Ben
I'm available to customise your themes or plugins for your Geeklog CMS
Text Formatted Code
function phpblock_topdownloads()
{
global $_CONF, $_TABLES, $_USER;
//set limit here
$limit = 10;
$poplist = '';
$query = "SELECT f.* FROM {$_TABLES['downloads']} AS f
LEFT JOIN {$_TABLES['downloadcategories']} AS c
ON c.cid = f.cid
";
$query .= COM_getPermSQL('WHERE', 0, 2, 'c' );
$query .= " ORDER BY hits DESC LIMIT {$limit}";
$result = DB_query($query);
$nrows = DB_numRows($result);
if( $nrows > 0 ){
$string = '';
$popular = array();
for( $i = 0; $i < $nrows; $i++ ){
$A = DB_fetchArray( $result );
$string .= $poplist . '';
$popular[] = '<a href="' . $_CONF['site_url']
. '/downloads/index.php?id=' . $A['lid'] . '">' . $A['title']
. '</a> (' . $A['hits'] . ')';
}
if( !empty( $popular )){
$poplist = COM_makeList( $popular, 'list-popular-stories' );
}
}
if ($poplist == '') $poplist = 'Sorry, there is no available data.';
return $poplist;
}
Ben
I'm available to customise your themes or plugins for your Geeklog CMS
11
8
Quote
All times are EST. The time is now 04:34 pm.
- 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