Posted on: 09/02/06 04:52pm
By: DubiousChrisJ
function phpblock_mostPopular() { global $_TABLES; $result = DB_query("SELECT sid,title,hits FROM {$_TABLES['stories']} WHERE (draft_flag = 0) AND (date <= NOW()) AND (hits > 0)" . COM_getPermSQL ('AND') . " ORDER BY hits desc LIMIT 10"); $nrows = DB_numRows($result); if( $nrows > 0 ){ $string = ''; $popular = array(); for( $i = 0; $i < $nrows; $i++ ){ $A = DB_fetchArray( $result ); $string .= $poplist . '<br>'; $popular[] = '<a href="' . COM_buildUrl( $_CONF['site_url'] . '/article.php?story=' . $A['sid'] ) . '">' . $A['title'] . '</a> (' . $A['hits'] . ')'; } if( !empty( $popular )){ $poplist = COM_makeList( $popular, 'list-popular-stories' ); } } return $poplist; }