Welcome to Geeklog Thursday, October 19 2017 @ 01:33 am EDT


Status: offline

::Ben

Forum User
Full Member
Registered: 14/01/2005
Posts: 1569
Location:la rochelle, France
Tested with downloads plugin 1.0.4. Demo at the bottom of this page.

PHP 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

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