<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />

<title>Blog Posts</title>
<style type="text/css">
<!--
.rss{
width:200px;
display:block;
float:left;}

.rss h3 a{
color:#89b81d}

-->
</style>
</head>
<body>
<h2>Foo</h2>
<?php

$insideitem = false;
$tag = "";
$title = "";
$description = "";
$link = "";
$i = 0;


function startElement($parser, $name, $attrs) {
	global $insideitem, $tag, $title, $description, $link;
	if ($insideitem) {
		$tag = $name;
	} elseif ($name == "ITEM") {
		$insideitem = true;
	}
}

function endElement($parser, $name) {
	global $insideitem, $tag, $title, $description, $link,$i;
	
		if ($name == "ITEM" && $i < 1) {
		printf("<div class="rss"><h3 class="rssHeader"><a href='%s'>%s</a></h3>", trim($link),utf8_decode(htmlspecialchars(trim($title))));
		
		//Ohne Beschränkung
		//printf("<p>%s</p></div>",utf8_decode(htmlspecialchars(trim($description))));
		
		//Mit Beschränkung
		$short = explode("n", wordwrap($description, 150, "n")); //Ausgabe auf n Zeichen kürzen
		printf("<p>%s ...</p><a href='".trim($link)."'>mehr</a></div>",htmlspecialchars(trim($short[0])));
		
		$title = "";
		$description = "";
		$link = "";
		$insideitem = false;
		$i++;
	}
}


function characterData($parser, $data) {
	global $insideitem, $tag, $title, $description, $link;
	if ($insideitem) {
	switch ($tag) {
		case "TITLE":
		$title .= $data;
		break;
		case "DESCRIPTION":
		$description .= $data;
		break;
		case "LINK":
		$link .= $data;
		break;
	}
	}
}

$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_set_character_data_handler($xml_parser, "characterData");
$fp = fopen("http://blogurl.com/rss.php","r")
	or die("Error reading RSS data.");
while ($data = fread($fp, 4096))
	xml_parse($xml_parser, $data, feof($fp))
		or die(sprintf("XML error: %s at line %d", 
			xml_error_string(xml_get_error_code($xml_parser)), 
			xml_get_current_line_number($xml_parser)));
fclose($fp);
xml_parser_free($xml_parser);

?>
</body>
</html>