Ver Mensaje Individual
  #1 (permalink)  
Antiguo 22/02/2007, 08:46
malastic
 
Fecha de Ingreso: junio-2006
Ubicación: Madrid - España
Mensajes: 179
Antigüedad: 17 años, 11 meses
Puntos: 6
Necesito ayuda con este código.

Buenas tardes. Estoy pasando una validación W3C XHTML y me da errores, aunque funciona perfectamente. Casi todo viene de un módulo PHP que tengo para que me muestro los juegos de forma aleatoria en la página de inicio. El código PHP de ese módulo es:

<?php
/**
* @version 1.0 $
* @package SMFArcadeRandom
* @copyright (C) 2005 Melissa Padilla
*
* This module assumes Simple Machines Forum (SMF) is installed, functioning and running wrapped in mambo with
* the mos-smf bridge. This module also assumes that smf_arcade is installed in SMF and functioning already.
*
*/

defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

global $database, $smf_prefix, $mosConfig_absolute_path, $boardurl;

//require($mosConfig_absolute_path . "/administrator/components/com_smf/config.smf.php");

// Retrieve module parameters or set defaults if module parameters empty
$count = intval( $params->get( 'count', 5 ) );
$noscore = $params->get( 'noscore', 'No Scores Yet');
$topscore = $params->get( 'topscore', 'Top Scores');
$gamefolder = $params->get( 'gamefolder', 'Games');
$show_thumb = $params->get('show_thumb', 'yes');
$show_game_name = $params->get('show_game_name', 'yes');
$show_scores = $params->get('show_scores', 'yes');
$ext = array('gif','GIF','png','PNG','jpg','JPG',); // Extensions to look for
$game_id = intval( $params->get( 'game_id', 55) );
// Load a random game
$query = "SELECT DISTINCT id , game, name, thumb FROM smf_games order by RAND() LIMIT 1";
$database ->setQuery("SELECT DISTINCT id , game, name FROM smf_games ORDER BY RAND() LIMIT 1");
$results = $database->loadObjectList();

//if ($result = $database->query()) {
// $row = mysql_fetch_object($result);
// $smfItemid = $row->id;
//}
//else {
// echo "Error fetching smfItemid: ".mysql_errno()." ".mysql_error();
// return false;
//}
foreach($results as $row){
// Build table with game thumbnail, title and link to arcade for playing
echo "<table border=\"0\" align=\"center\">";

if (strcasecmp($show_thumb, "yes") == 0){
// Set thumbnail of the random game selected above
$thumb = $boardurl. "/" .$gamefolder."/".$row->game.".gif";
echo "<tr><td colspan=\"2\" align=\"center\"><a href=\"index.php?option=com_smf&Itemid=" . $game_id . "&action=arcade;sa=play;game=" . $row->id . "\"><img src=\"$thumb\" border=\"0\"/></a></td></tr>";
}

if (strcasecmp($show_game_name, "yes") == 0){
// Set game name as link
echo "<tr><td colspan=\"2\" align=\"center\"><a href=\"index.php?option=com_smf&Itemid=". $game_id . "&action=arcade;sa=play;game=" . $row->id . "\">$row->name</a><br></td></tr>";
}

if (strcasecmp($show_scores, "yes") == 0){
// Retrieve highscores for the random game selected above based on 'count' module parameter
$query2 = "Select game, member, score, smf_members.ID_MEMBER, smf_members.realName from smf_games_high, smf_members WHERE game = '$row->game' AND smf_members.ID_MEMBER = smf_games_high.member ORDER BY score DESC LIMIT {$count}";
$database->setQuery("Select game, member, score, smf_members.ID_MEMBER, smf_members.realName from smf_games_high, smf_members WHERE game = '$row->game' AND smf_members.ID_MEMBER = smf_games_high.member ORDER BY score DESC LIMIT {$count}");
$HSrows = $database->loadObjectList();
$HSrow=$HSrows[0];

//Build last 'count' highscore rows or set to 'noscore' if no scores yet
if (!isset($HSrow->realName)){
echo "<tr><td colspan=\"2\" align=\"center\">" . $noscore . "</td></tr>";
}else{
echo "<tr><td colspan=\"2\" align=\"center\">" . $count . " " . $topscore . "</td></tr>";
foreach($HSrows as $HSrow){
echo "<tr ><td width='60%' class='sectiontableentry2'>" . $HSrow->realName . "</td><td width='40%' align='right' class='sectiontableentry2'>" . (float)$HSrow->score . "</td></tr>";
}
}
}
}

echo "</table>";

?>


Se que hay cosas que están mal, pero he hecho pruebas y no consigo averiguar cual es.

La parte en rojo, es la que creo, la que produce los fallos.

Si alguien puede /sabe ayudarme le estaré agradecido. Mi sitio es malastic . com.

Un saludo,