<?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_nba.htm');
$file = $_GET['file'];

$colores = "";
$tpl->setVariable('fecha', date("d/m/Y"));

if (file_exists($file) && is_readable($file)) {
	
    if (!$myxml = simplexml_load_file($file))
        echo 'Error al Cargar Archivo XML';
    else {
        foreach ($myxml as $node) {
			
            if ($colores == "#A6C2FF") {
                $tpl->setVariable('colores', 'bgcolor=""');
                $colores = "";
            } else {
                $tpl->setVariable('colores', 'bgcolor="#A6C2FF"');
                $colores = "#A6C2FF";
            }
            
            $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('q1v', BlankSpace(utf8_decode($node->P1V)));
            $tpl->setVariable('q1l', BlankSpace(utf8_decode($node->P1L)));
            
            $tpl->setVariable('q2v', BlankSpace(utf8_decode($node->P2V)));
            $tpl->setVariable('q2l', BlankSpace(utf8_decode($node->P2L)));
            
            $tpl->setVariable('q3v', BlankSpace(utf8_decode($node->P3V)));
            $tpl->setVariable('q3l', BlankSpace(utf8_decode($node->P3L)));
            
            $tpl->setVariable('q4v', BlankSpace(utf8_decode($node->P4V)));
            $tpl->setVariable('q4l', BlankSpace(utf8_decode($node->P4L)));
            
            $tpl->setVariable('otv', BlankSpace(utf8_decode($node->PXV)));
            $tpl->setVariable('otl', BlankSpace(utf8_decode($node->PXL)));
            
            $tpl->setVariable('tv', BlankSpace(utf8_decode($node->JCV)));
            $tpl->setVariable('tl', BlankSpace(utf8_decode($node->JCL)));
            
            $tpl->setVariable('nota', BlankSpace(utf8_decode($node->NOTE)));
            
            $tpl->parse('bloque1');
            
        } //for.
    } //else
}
$tpl->show();

?>