//////////////////////////////////////////////////// // Example of displaying SEMLA table for a single division // // Copyright (C) 2006 Dave Slaughter dave@purleylax.co.uk // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // See http://www.gnu.org/copyleft/lesser.html //////////////////////////////////////////////////// require_once('rest.inc'); $xmlfile = 'mens-division.xml'; // local file name to store XML data $xmlurl = 'http://www.southlacrosse.org.uk/rest/tables/mens/Prem'; // URL of data on South Lacrosse site // get the data from the South Lacrosse server, caching results for 2 hours $httpCache = new httpCache($xmlurl,$xmlfile); $httpCache->fetch(); // optimisation to send as little data as possible to the browser // Parameter is the dependancies of this page - currently only the xml // file, but if there are others then add to the array cacheHeaders(array($xmlfile)); // parse XML data into arrays for easier processing if (!$httpCache->isError()) { $parser = new simpleParser(); $xml = &$parser->parseString($httpCache->getXml()); } // output page heading ?>
Error retrieving data : ' . $httpCache->getError() . "
\n"; } elseif (!$xml) { echo 'Error converting data : ' . $parser->getError() . "
\n"; } else { // print heading for the division, and table heading for the league table for this division echo '| Played | Won | Drawn | Lost | For | Against | Goal Diff. | Goal Ave. | Points | |
|---|---|---|---|---|---|---|---|---|---|
| echo $team->{'team-name'}; ?> | echo $played; ?> | echo $team->won; ?> | echo $team->drawn; ?> | echo $team->lost; ?> | echo $team->for; ?> | echo $team->against; ?> | echo $diff; ?> | echo $ave; ?> | echo $team->points; ?> |
Data provided by southlacrosse.org.uk