--- web/trunk/www.linuxsampler.org/news_internal.php 2007/08/07 19:56:17 1268
+++ web/trunk/www.linuxsampler.org/news_internal.php 2007/10/12 14:34:42 1409
@@ -5,10 +5,23 @@
// show all news entries by default
$max_items = -1;
+$current_tag = array();
+$current_tag_attribs = 0;
+$current_tag_body_is_empty = true;
+$current_link_ref = "";
+
function startElement($parser, $name, $attribs) {
global $max_items;
+ global $current_tag;
+ global $current_tag_body_is_empty;
+ global $current_link_ref;
+
if ($max_items == 0) return;
+ array_push($current_tag, $name);
+
+ $current_tag_body_is_empty = true;
+
if ($name == "entry") {
if (count($attribs) && isset($attribs["date"])) {
$d = $attribs["date"];
@@ -16,8 +29,8 @@
echo "$d ";
} else echo "??? ";
} else if ($name == "link") {
- $addr = (isset($attribs["ref"])) ? $attribs["ref"] : "";
- echo "";
+ $current_link_ref = (isset($attribs["ref"])) ? $attribs["ref"] : "";
+ echo "";
} else if ($name == "list") {
echo "";
} else if ($name == "li") {
@@ -27,18 +40,33 @@
function endElement($parser, $name) {
global $max_items;
+ global $current_tag;
+ global $current_tag_body_is_empty;
+ global $current_link_ref;
+
if ($max_items == 0) return;
+ array_pop($current_tag);
+
if ($name == "entry") { echo "\n";
if ($max_items > 0) $max_items--;
}
- else if ($name == "link") echo "
";
+ else if ($name == "link") {
+ if ($current_tag_body_is_empty) echo $current_link_ref;
+ echo "";
+ $current_link_ref = ""; // reset
+ }
else if ($name == "list") echo "";
else if ($name == "li") echo "";
}
function characterData($parser, $data) {
global $max_items;
+ global $current_tag;
+ global $current_tag_body_is_empty;
+
+ $current_tag_body_is_empty = false;
+
if ($max_items == 0) return;
echo $data;