home *** CD-ROM | disk | FTP | other *** search
- <?
-
-
-
- $channel = array();
-
-
-
- function opening_element($parser, $element, $attributes) {
-
- global $c, $i, $flag, $type;
-
- switch ($element) {
-
- case "channel":
-
- $type = $element;
-
- $channel[$c]["items"] = array();
-
- break;
-
- case "item":
-
- $type = $element;
-
- $channel[$c]["items"][$i] = array();
-
- break;
-
- case "image":
-
- $type = $element;
-
- $channel[$c]["image"] = array();
-
- break;
-
- default:
-
- $flag = $element;
-
- break; } }
-
-
-
- function closing_element($parser, $element) {
-
- global $c, $i, $flag, $type;
-
- switch ($element) {
-
- case "channel":
-
- $type = '';
-
- $c++;
-
- break;
-
- case "item":
-
- $type = '';
-
- $i++;
-
- break;
-
- case "image":
-
- $type = '';
-
- break;
-
- default:
-
- $flag = '';
-
- break; } }
-
-
-
- function character_data($parser, $data) {
-
- global $i, $channel, $flag, $type;
-
- switch ($type) {
-
- case "channel":
-
- $channel[$c][$flag] = $data;
-
- break;
-
- case "item":
-
- $channel[$c]["items"][$i][$flag] = $data;
-
- break;
-
- case "image":
-
- $channel[$c]["image"][$flag] = $data;
-
- break; } }
-
-
-
- $parser = xml_parser_create();
-
- xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, false);
-
- xml_set_element_handler($parser, 'opening_element', 'closing_element');
-
- xml_set_character_data_handler($parser, 'character_data');
-
- $document = file('http://quiddity/articles/RSS/feed.rss');
-
- foreach ($document as $line) {
-
- xml_parse($parser, $line); }
-
- xml_parser_free($parser);
-
-
-
- foreach ($channel as $thisChannel) {
-
- echo "
-
- <html><head><title>".$thisChannel["title"]."</title></head>
-
- <body>";
-
-
-
- if ($thisChannel["image"]) {
-
- echo "<img src='".$thisChannel["image"]["url"]."' alt='".$thisChannel["image"]["title"]."' width='".$thisChannel["image"]["width"]."' height='".$thisChannel["image"]["height"]."' >"; }
-
-
-
- echo "
-
- <p><a href='".$thisChannel["link"]."'>".$thisChannel["title"]."</a></p>
-
- <p>".$thisChannel["description"]."</p>
-
- <p align=center><table width=80%>
-
- ";
-
-
-
- foreach ($thisChannel["items"] as $thisItem) {
-
- echo "
-
- <tr><td><a href='".$thisItem["link"]."'>".$thisItem["title"]."</a>
-
- <br>".$thisItem["description"]."</td></tr>
-
- "; }
-
-
-
- echo "
-
- </table></p>
-
- </body></html>"; }
-
-
-
- ?>