From: Job R. <jo...@us...> - 2008-09-03 21:32:02
|
Update of /cvsroot/offl/offl/www In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv23513 Modified Files: games.php Log Message: fixed parsing for 2008 NFL Schedule from sportsline Index: games.php =================================================================== RCS file: /cvsroot/offl/offl/www/games.php,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** games.php 11 Sep 2007 02:37:02 -0000 1.11 --- games.php 3 Sep 2008 21:32:11 -0000 1.12 *************** *** 83,89 **** //echo $schedstring; ! $parser = new HtmlParser ($schedstring); while ($parser->parse()) { //echo "iNodeName: " . $parser->iNodeName . ", iNodeValue: " . $parser->iNodeValue . ", iNodeType: " . $parser->iNodeType . "<br/>"; --- 83,97 ---- //echo $schedstring; ! //$f = fopen("g08.txt", "w"); ! //fwrite( $f, $schedstring); ! //fclose( $f); ! $parser = new HtmlParser ($schedstring); + $t1 = ""; + $t2 = ""; + $t3 = ""; + $at_found = false; + while ($parser->parse()) { //echo "iNodeName: " . $parser->iNodeName . ", iNodeValue: " . $parser->iNodeValue . ", iNodeType: " . $parser->iNodeType . "<br/>"; *************** *** 100,103 **** --- 108,133 ---- } + // rotary buffer for 2008 game schedule listing + // each game team is href'd with 'at' between + // so parsing is splitting into seperate elements + // + if ($parser->iNodeName == "Text") { + $t3 = $t2; + $t2 = $t1; + $t1 = $parser->iNodeValue; + if ($at_found) { + $at_found = false; + $vteam = $t3; + $hteam = $t1; + echo "<br/>----" . $t3 . " at " . $parser->iNodeValue; + $x = new OFFL_NFLTeam(); + $vabbv = $x->getNFLTeamBySchedName($vteam); + $habbv = $x->getNFLTeamBySchedName($hteam); + }; + }; + + if (strpos(" " . trim($parser->iNodeValue) . " ", " at ") !== false) { + $at_found = true; + }; if (strpos(trim($parser->iNodeValue), " at ") !== false) { list($vteam, $hteam) = explode(" at ", $parser->iNodeValue, 2); *************** *** 118,122 **** //http://www.sportsline.com/nfl/gamecenter/live//NFL_20070817_MIN@NYJ ! echo " -- " . "http://www.sportsline.com/nfl/gamecenter/live//NFL_" . $gamedate . "_" . $vabbv->getNFLTeamAbbv() . "@" . $habbv->getNFLTeamAbbv(); $thisGame = new OFFL_NFLGame(); --- 148,152 ---- //http://www.sportsline.com/nfl/gamecenter/live//NFL_20070817_MIN@NYJ ! echo " -- " . "http://www.sportsline.com/nfl/gamecenter/live/NFL_" . $gamedate . "_" . $vabbv->getNFLTeamAbbv() . "@" . $habbv->getNFLTeamAbbv(); $thisGame = new OFFL_NFLGame(); *************** *** 269,273 **** $timeDiff = time() - $game->getGametime(); if ($timeDiff > 0) ! { $url="http://www.sportsline.com/nfl/gamecenter/live//NFL_" . date("Ymd", $game->getGametime()) . "_" . $game->getVNFLTeamAbbv() . "@" . $game->getHNFLTeamAbbv(); } echo "<tr class=\""; --- 299,303 ---- $timeDiff = time() - $game->getGametime(); if ($timeDiff > 0) ! { $url="http://www.sportsline.com/nfl/gamecenter/live/NFL_" . date("Ymd", $game->getGametime()) . "_" . $game->getVNFLTeamAbbv() . "@" . $game->getHNFLTeamAbbv(); } echo "<tr class=\""; *************** *** 605,607 **** } ! require($DOC_ROOT . "/lib/footer.php"); ?> \ No newline at end of file --- 635,637 ---- } ! require($DOC_ROOT . "/lib/footer.php"); ?> |