Welcome to Geeklog, Anonymous Wednesday, April 17 2024 @ 08:37 pm EDT

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.

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
 Quote

All times are EDT. The time is now 08:37 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