<?php class xItem { var $xTitle; var $xLink; var $xUpdated; var $xDescription; var $xAuthor; } $sTitle = ""; $sLink = ""; $sDescription = ""; $sLanguage = ""; $sWebMaster = ""; $itemCount = 0; function startElement($parser, $name, $attrs) { $curTag .= "^$name"; } function endElement($parser, $name) { } function characterData($parser, $data) { // get the Channel information first $titleKey = "^RSS^CHANNEL^TITLE"; $linkKey = "^RSS^CHANNEL^LINK"; $descKey = "^RSS^CHANNEL^DESCRIPTION"; $langKey = "^RSS^CHANNEL^LANGUAGE"; $webmKey = "^RSS^CHANNEL^WEBMASTER"; if ($curTag == $titleKey) { $sTitle = $data; } elseif ($curTag == $linkKey) { $sLink = $data; } elseif ($curTag == $descKey) { $sDescription = $data; } elseif ($curTag == $langKey) { $sLanguage = $data; } elseif ($curTag == $webmKey) { $sWebMaster = $data; } // now get the items $itemTitleKey = "^RSS^CHANNEL^ITEM^TITLE"; $itemLinkKey = "^RSS^CHANNEL^ITEM^LINK"; $itemUpdKey = "^RSS^CHANNEL^ITEM^UPDATED"; $itemDescKey = "^RSS^CHANNEL^ITEM^DESCRIPTION"; $itemAuthKey = "^RSS^CHANNEL^ITEM^AUTHOR"; if ($curTag == $itemTitleKey) { // make new xItem $arItems[$itemCount] = new xItem(); // set new item object's properties $arItems[$itemCount]->xTitle = $data; } elseif ($curTag == $itemLinkKey) { $arItems[$itemCount]->xLink = $data; } elseif ($curTag == $itemUpdKey) { $arItems[$itemCount]->xUpdated = $data; } elseif ($curTag == $itemDescKey) { $arItems[$itemCount]->xDescription = $data; } elseif ($curTag == $itemAuthKey) { $arItems[$itemCount]->xAuthor = $data; // increment item counter $itemCount++; } // main loop $xml_parser = xml_parser_create(); xml_set_element_handler($xml_parser, "startElement", "endElement"); xml_set_character_data_handler($xml_parser, "characterData"); } xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser))); } } xml_parser_free($xml_parser); ?>
<?php for($x=0;$x<count($arItems);$x++){ } ?>
i taki generowany plik rss
<rss version="2.0"> <channel> <title>tytuł</title> <link>link</link> <description>opi</description> <language>pl</language> <webMaster>email</webMaster> <image> <title>tytuł</title> <link>link</link> <url>url</url> <height>height</height> <width>width</width> </image> <item> <title>tytuł</title> <link>link</link> <updated>data</updated> <description>opis</description> <author>email</author> </item> </channel> </rss>
po uruchomieniu skryptu php wyświetla mi się
Parse error: syntax error, unexpected $end on line 123. POMOCY