Ver Mensaje Individual
  #1 (permalink)  
Antiguo 14/06/2007, 22:14
Avatar de destor77
destor77
 
Fecha de Ingreso: noviembre-2004
Ubicación: Gálvez, Santa Fe, Argentina
Mensajes: 2.654
Antigüedad: 19 años, 6 meses
Puntos: 43
Ayuda con funciones de una clase

buenas:
buscando por google encontre una clase que me sirve para lo que estoy intentando hacer para mi pagina de hattrick.
Bueno el tema es que pude hacer varias cosas, lo que intento hacer ahora es que me muestre la cantidad de partidos que tiene un equipo, pero no me sale.
La clase usa las siguientes funciones para eso:
parte del archivo htclient.php
Código PHP:
/**
 * Retrieve matches archive for team $id, or for user's own team.
 *
 * @param    string   teamID
 * @access   public
 */
function getMatchesArchiveXML($id false$cup false$first false$last false$season false) {

    
$form = array('outputType' => 'XML');
    if (
$cup)
        
$form['actionType'] = 'viewCup';
    else
        
$form['actionType'] = 'view';
    if (
$id)
        
$form['teamID'] = $id;
    if (
$first)
        
$form['FirstMatchDate'] = $first;
    if (
$last)
        
$form['LastMatchDate'] = $last;
    if (
$season)
        
$form['Season'] = $season;
    
$code $this->http->post(HT_MATCHESARCHIVE$form'http://'.$this->http->host.HT_HOME);
    if (
$code != 200)
        return 
false;
    return 
$this->http->get_response_body();
}

/**
 * Retrieve matches archive for team $id, or for user's own team.
 *
 * @param    string   teamID
 * @access   public
 */
function getMatchesArchive($id false$cup false$first false$last false$season false) {
    if ((! 
$id) && ($this->matchesArchive))
        return 
$this->matchesArchive;
    
$xml $this->getMatchesArchiveXML($id$cup$first$last$count$season);
    if (
$xml) {
        
$parser xml_parser_create();
        
xml_parse_into_struct($parser$xml$vals$index);
        
xml_parser_free($parser);
        if (! 
$vals[$index['FILENAME'][0]]['value'])
            return 
false;
        for (
$i 0$i count($index['MATCHID']); $i++) {
            
$match[$i] = array(
                
'MATCHID' => $vals[$index['MATCHID'][$i]]['value'],
                
'HOMETEAMID' => $vals[$index['HOMETEAMID'][$i]]['value'],
                
'HOMETEAMNAME' => $vals[$index['HOMETEAMNAME'][$i]]['value'],
                
'AWAYTEAMID' => $vals[$index['AWAYTEAMID'][$i]]['value'],
                
'AWAYTEAMNAME' => $vals[$index['AWAYTEAMNAME'][$i]]['value'],
                
'MATCHDATE' => $vals[$index['MATCHDATE'][$i]]['value'],
                
'MATCHTYPE' => $vals[$index['MATCHTYPE'][$i]]['value'],
                
'HOMEGOALS' => $vals[$index['HOMEGOALS'][$i]]['value'],
                
'AWAYGOALS' => $vals[$index['AWAYGOALS'][$i]]['value']
            );
        }
        
$this->matchesArchive = array(
            
'FILENAME' => $vals[$index['FILENAME'][0]]['value'],
            
'VERSION' => $vals[$index['VERSION'][0]]['value'],
            
'USERID' => $vals[$index['USERID'][0]]['value'],
            
'FETCHEDDATE' => $vals[$index['FETCHEDDATE'][0]]['value'],
            
'TEAMID' => $vals[$index['TEAMID'][0]]['value'],
            
'TEAMNAME' => $vals[$index['TEAMNAME'][0]]['value'],
            
'FIRSTMATCHDATE' => $vals[$index['FIRSTMATCHDATE'][0]]['value'],
            
'LASTMATCHDATE' => $vals[$index['LASTMATCHDATE'][0]]['value'],
            
'MATCH' => $match
        
);
        return 
$this->matchesArchive;
    }
    else return 
false;

Yo mirando parte del ejemplo que trae la clase intento esto:
Código PHP:
<?php
require_once 'HTClient.php';

session_start();
if (! 
$_SESSION['htclient']) {
    
header('Location: error.php?code=0');
    exit();
}

// Get the HTClient class instance from session variables.
$htclient $_SESSION['htclient'];

// Get teamDetails.asp XML formation. That should be already in the cache.
$team $htclient->getTeamDetails();
if (! 
$team) {
    
$htclient->logout();
    
header('Location: error.php?code=2');
    exit();
}

//
$partidos $htclient->getMatchesArchive();
if (! 
$partidos) {
    
$htclient->logout();
    
header('Location: error.php?code=2');
    exit();
}

<
p>total partidos: <br /><?php
            
for ($i 0$i<count($partidos['MATCH']); $i++) {
                    
$partidos $partidos['MATCH'][$i];
            echo 
$partidos['MATCHID']; echo '<br />';
            
/*echo htmlentities($partidos['MATCHDATE']); echo '<br />';
            echo htmlentities($partidos['HOMETEAMNAME']); echo '<br />';
            echo htmlentities($partidos['AWAYTEAMNAME']); echo '<br />';
            echo htmlentities($partidos['HOMEGOALS']); echo '<br />';
            echo htmlentities($partidos['AWAYGOALS']); echo '<br />';
            echo '<br />'; */
            
}
            echo 
"hay $i partidos";

?>
Con ese codigo me muestra solo un registro, en vez de 23 que es la cantidad total.
En que le estoy errando?
Espero que me puedan dar una mano.
Desde ya muchas gracias