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.
admin

Karma: 112  
Re:Modifying Top Uploaders module - 2006/10/13 10:07 Your code is outside the HTML table, and the output is probably getting lost somewhere. Look a bit further down for the line that reads:
Code:

 $content .= $uploader->name."</b></td><td align='right'><b>";


and change it to:
Code:

 $content .= ($uploader->name $uploader->name 'Unknown')."</b></td><td align='right'><b>";


- that should work.
Martin Brampton aka Counterpoint
http://aliro.org
http://black-sheep-research.com
  | | Sorry, you do not currently have permission to write here.
vibez

Karma: -1  
Re:Modifying Top Uploaders module - 2006/10/13 10:43 That worked perfect thanks

I don't suppose there is a way to ignore any blank results, so that they wouldn't get shown at all on the list?
  | | Sorry, you do not currently have permission to write here.
admin

Karma: 112  
Re:Modifying Top Uploaders module - 2006/10/13 15:34 Change the SQL statements! Martin Brampton aka Counterpoint
http://aliro.org
http://black-sheep-research.com
  | | Sorry, you do not currently have permission to write here.
vibez

Karma: -1  
Re:Modifying Top Uploaders module - 2006/10/14 11:06 cheers

WHERE published=1 AND fileversion !=''

worked a treat

Post edited by: vibez, at: 2006/10/14 06:17
  | | Sorry, you do not currently have permission to write here.

Save FM Radio

Login

Subscribe to Premium Support

Get priority support for Remository and Glossary, sign up now for a Premium Support monthly subscription:

Your Remository user name

Or purchase a year's support:

Your Remository user name

Who is Online

Remository welcomes guests and visitors

We have 1 guest online