Mam taki plik
<?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) {
$curTag = substr($curTag,0
,$caret_pos); }
function characterData($parser, $data) {
// get the Channel information first
global $sTitle, $sLink, $sDescription, $sLanguage, $sWebMaster; $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");
if (!($fp = fopen("rss.xml","r"))) { die ("could not open RSS for input"); }
while ($data = fread($fp, 4096
)) { if (!xml_parse
($xml_parser, $data, feof($fp))) { xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));
}
}
xml_parser_free($xml_parser);
?>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <link rel="alternate" type="application/rss+xml" title="4asy" href="rss.xml" />
<?php
for($x=0;$x<count($arItems);$x++){
echo $arItems[$x]->xTitle; echo $arItems[$x]->xUpdated; echo $arItems[$x]->xDescription; echo "<a href=" . $arItems[$x]->xLink . ">Zobacz całość</a>"; echo $arItems[$x]->xAuthor; }
?>
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