Home arrow Forum

Remository Forum

 


vibez

Karma: -1  
Modifying Top Uploaders module - 2006/10/12 23:29 I need to help. I have modified the top uploaders module to look in the fileversion field.

The only problem is that obviously if that column is blank in the database table it can end up generating lists like this

(8899)
version 1 (339)
version 2 (125)
version 3 (99)

Notice the top result is blank.

Basically, instead of the module returning the bank result, I want it return the words "unknown"

Kind of like this

Code:

 if ($name) { echo "$name"; } else { echo "unknown"; }



But for whatever reason, that code is not working for me. So I need some basic php code help.

Code:

 <?php /** * FileName: mod_remositoryartists.php * Date: 20 June 2006 * License: GNU General Public License * Script Version #: 3.25 * ReMOSitory Version #: 3.20 or above * MOS Version #: 4.5 or above * Author: Martin Brampton - martin@remository.com (http://www.remository.com) * Copyright: Martin Brampton 2006 **/ defined'_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); global $mosConfig_absolute_path$mosConfig_absolute_path$my; require_once ($mosConfig_absolute_path.'/components/com_remository/remository.utilities.php'); /*********************Configuration*********************/ // Max number of entries to show $max remositoryUtilities::realiro_get_module_parm($params,'max',); $max max($max,1); /*******************************************************/ include('components/com_remository/com_remository_settings.php'); function topArtists ($max) {     global $database;     $sql "SELECT COUNT(id) AS uploads, fileversion AS name FROM aliro_downloads_files WHERE published=1  GROUP BY fileversion ORDER BY uploads DESC LIMIT $max";     $database->setQuery($sql);     $uploaders $database->loadObjectList();     if ($uploaders) return $uploaders;     else return array(); } $tabclass_arr=explode(",",$tabclass); $name $uploader->name;  if ($name) { echo "$name"; } else { echo "unknown"; } // Top Uploaders $people topArtists ($max); $content remositoryUtilities::realiro_module_CSS (); $tabcnt 0; foreach ($people as $uploader) {     $class $tabclass_arr[$tabcnt];     $content .= "<tr><td width='20%' align='left' ><b>";     $content .= $uploader->name."</b></td><td align='right'><b>";     $content .= $uploader->uploads;     $content .= "</B></td></tr>n";     if ($tabcnt == 1){     $tabcnt 0;     } else {     $tabcnt++;     } } $content .= "</table>n"; ?>



Post edited by: vibez, at: 2006/10/12 18:29
  | | Sorry, you do not currently have permission to write here.

      Topics Author Date
    thread link
Modifying Top Uploaders module
vibez 2006/10/12 23:29
    thread link
thread link Re:Modifying Top Uploaders module
admin 2006/10/13 10:07
    thread link
thread linkthread link Re:Modifying Top Uploaders module
vibez 2006/10/13 10:43
    thread link
thread linkthread linkthread link Re:Modifying Top Uploaders module
admin 2006/10/13 15:34
    thread link
thread linkthread linkthread linkthread link Re:Modifying Top Uploaders module
vibez 2006/10/14 11:06

Menu

Login Form

Username

Password

Remember me
Password Reminder
No account yet?
Create one

Who is Online

Remository welcomes guests and registered users.

We have 11 guest online