<?php
ob_start();
header("Expires: Mon, 20 Mar 1998 12:01:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");

require_once("Sigma.php");
mb_http_output('UTF-8');

$tpl =& new HTML_Template_Sigma('.', './template/cache');
$tpl->loadTemplateFile('r_mlb.htm');
$tpl->setVariable('fecha', date("d/m/Y"));
$file = $_GET['file'];
$colores = "";

if (file_exists($file) && is_readable($file))
{
  if (!$myxml = simplexml_load_file($file))
    echo 'Error al Cargar Resultados';
  else
  {
    foreach ($myxml as $node)
    {
      if ($colores == "grey")
      {
        $tpl->setVariable('colores', '');
        $colores = "";
      }
      else
      {
        $tpl->setVariable('colores', ' class="grey"');
        $colores = "grey";
      }
      
      $tpl->setVariable('nombre', $myxml->getName());
      $tpl->setVariable('dep', $node->Liga);
      
      $tpl->setVariable('cod_v', $node->VisTeam);
      $tpl->setVariable('equipo_v', $node->EquipoVisitante);
      $tpl->setVariable('cod_l', $node->LocTeam);
      $tpl->setVariable('equipo_l', $node->EquipoLocal);
      
      $tpl->setVariable('v1', BlankSpace(utf8_decode($node->P1V)));
      $tpl->setVariable('l1', BlankSpace(utf8_decode($node->P1L)));
      
      $tpl->setVariable('v2', BlankSpace(utf8_decode($node->P2V)));
      $tpl->setVariable('l2', BlankSpace(utf8_decode($node->P2L)));
      
      $tpl->setVariable('v3', BlankSpace(utf8_decode($node->P3V)));
      $tpl->setVariable('l3', BlankSpace(utf8_decode($node->P3L)));
      
      $tpl->setVariable('v4', BlankSpace(utf8_decode($node->P4V)));
      $tpl->setVariable('l4', BlankSpace(utf8_decode($node->P4L)));
      
      $tpl->setVariable('v5', BlankSpace(utf8_decode($node->P5V)));
      $tpl->setVariable('l5', BlankSpace(utf8_decode($node->P5L)));
      
      $tpl->setVariable('v6', BlankSpace(utf8_decode($node->P6V)));
      $tpl->setVariable('l6', BlankSpace(utf8_decode($node->P6L)));
      
      $tpl->setVariable('v7', BlankSpace(utf8_decode($node->P7V)));
      $tpl->setVariable('l7', BlankSpace(utf8_decode($node->P7L)));
      
      $tpl->setVariable('v8', BlankSpace(utf8_decode($node->P8V)));
      $tpl->setVariable('l8', BlankSpace(utf8_decode($node->P8L)));
      
      $tpl->setVariable('v9', BlankSpace(utf8_decode($node->P9V)));
      $tpl->setVariable('l9', BlankSpace(utf8_decode($node->P9L)));
      
      $tpl->setVariable('vo', BlankSpace(utf8_decode($node->PXV)));
      $tpl->setVariable('lo', BlankSpace(utf8_decode($node->PXL)));
      
      $tpl->setVariable('cv', BlankSpace(utf8_decode($node->JCV)));
      $tpl->setVariable('cl', BlankSpace(utf8_decode($node->JCL)));
      
      $tpl->setVariable('hv', BlankSpace(utf8_decode($node->HV)));
      $tpl->setVariable('hl', BlankSpace(utf8_decode($node->HL)));
      
      $tpl->setVariable('ev', BlankSpace(utf8_decode($node->EV)));
      $tpl->setVariable('el', BlankSpace(utf8_decode($node->EL)));
      
      $tpl->setVariable('nota', BlankSpace(utf8_decode($node->NOTE)));
      
      $tpl->parse('bloque1');
      
    } //for.
  } //else
}

$tpl->show();

?> 