Hi Joomlapolis citizens!
first of all, I have never worked with PHP, and never with CBplugins.
I want to create a 'highscore tab' for displaying the user highscores from this component:
mamboflashgames
i have study a lot of hours on other plugins, websites etc. But i don't get it ! i'm a bit ashame for the code that i have created. Because i know the code is not right at all. But I hope, someone with a better vision of programming can help me a bit.
This is the code... (don't laugh, because i can hear you

)
[code:1]<?php
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
/**
* Lists mamboflashgames highscores
* @author lennox
*/
class getgameTab extends cbTabHandler {
/**
* Constructor
*/
function getgameTab() {
$this->cbTabHandler();
}
/**
* Generates the HTML to display the user profile tab
* @param object tab reflecting the tab database entry
* @param object mosUser reflecting the user being displayed
* @param int 1 for front-end, 2 for back-end
* @returns mixed : either string HTML for tab content, or false if ErrorMSG generated
*/
function getDisplayTab($tab,$user,$ui) {
global $mosConfig_absolute_path, $database, $mosConfig_lang;
$gp_path = $mosConfig_absolute_path.'/components/com_comprofiler/plugin/user/plug_gameplugin';
if (file_exists($gp_path.'/language/'.$mosConfig_lang.'.php')) {
include_once($gp_path.'/language/'.$mosConfig_lang.'.php');
} else {
include_once($gp_path.'/language/english.php');
}
$return="";
$return .= _UE_GAMETAB_TITLE.'<br /><br />'
// sql try
$sSQL = 'SELECT a.gid, a.uname FROM #__mamboflashgames_savedgames a '.
'INNER JOIN #__mamboflashgames_scores b ON a.uname = b.score '.
'WHERE uname= '.$user->id.
$database->setQuery($sSQL);
$score=$database->loadObjectList();
$return .= '<table>';
foreach($scores as $score) {
$return .= '<tr><td>';
$return .= $score->uname.'</td><td>-></td>';
}
// create content
$return .= '</table>';
return $return;
}
} // end class getgameTab.
?>
[/code:1]
mamboflash games uses 3 tables:
mamboflashgames_categories
- id
title
name
published
description
image
image_position
ordering
count
parent
access
checked_out
checked_out_time
mamboflashgames_savedgames
-gid
uname
gameData
date
mamboflashgames_scores
-gid
uname
score
date
playTime
i hope someone can help me a little, what i am doing wrong (a think i'm doing 99% wrong

)
Thank you so much!
Post edited by: lennox, at: 2006/02/14 12:41