5 |
// show all news entries by default |
// show all news entries by default |
6 |
$max_items = -1; |
$max_items = -1; |
7 |
|
|
8 |
|
$current_tag = array(); |
9 |
|
$current_tag_body_is_empty = true; |
10 |
|
$current_link_ref = ""; |
11 |
|
|
12 |
function startElement($parser, $name, $attribs) { |
function startElement($parser, $name, $attribs) { |
13 |
global $max_items; |
global $max_items; |
14 |
|
global $current_tag; |
15 |
|
global $current_tag_body_is_empty; |
16 |
|
global $current_link_ref; |
17 |
|
|
18 |
if ($max_items == 0) return; |
if ($max_items == 0) return; |
19 |
|
|
20 |
|
array_push($current_tag, $name); |
21 |
|
|
22 |
|
$current_tag_body_is_empty = true; |
23 |
|
|
24 |
if ($name == "entry") { |
if ($name == "entry") { |
25 |
if (count($attribs) && isset($attribs["date"])) { |
if (count($attribs) && isset($attribs["date"])) { |
26 |
$d = $attribs["date"]; |
$d = $attribs["date"]; |
27 |
echo "<div class=\"news\">"; |
// pack into a (single cell) table so (flaoting) images wont vertically overlap out of the news block border |
28 |
|
echo "<div class=\"news\"><table><tr><td>"; |
29 |
echo "<span class=\"news_date\">$d</span> "; |
echo "<span class=\"news_date\">$d</span> "; |
30 |
} else echo "<b>???</b> "; |
} else echo "<b>???</b> "; |
31 |
} else if ($name == "link") { |
} else if ($name == "link") { |
32 |
$addr = (isset($attribs["ref"])) ? $attribs["ref"] : ""; |
$current_link_ref = (isset($attribs["ref"])) ? $attribs["ref"] : ""; |
33 |
echo "<a href=\"$addr\">"; |
echo "<a href=\"$current_link_ref\">"; |
34 |
|
if (count($attribs) && isset($attribs["img"])) { |
35 |
|
$pic = $attribs["img"]; |
36 |
|
echo "<img src=\"$pic\" style=\"float: left; margin: 4px;\">"; |
37 |
|
$current_tag_body_is_empty = false; |
38 |
|
} |
39 |
} else if ($name == "list") { |
} else if ($name == "list") { |
40 |
echo "<ul class=\"news\">"; |
echo "<ul class=\"news\">"; |
41 |
} else if ($name == "li") { |
} else if ($name == "li") { |
45 |
|
|
46 |
function endElement($parser, $name) { |
function endElement($parser, $name) { |
47 |
global $max_items; |
global $max_items; |
48 |
|
global $current_tag; |
49 |
|
global $current_tag_body_is_empty; |
50 |
|
global $current_link_ref; |
51 |
|
|
52 |
if ($max_items == 0) return; |
if ($max_items == 0) return; |
53 |
|
|
54 |
if ($name == "entry") { echo "</div>\n"; |
array_pop($current_tag); |
55 |
|
|
56 |
|
if ($name == "entry") { |
57 |
|
echo "</td></tr></table></div>\n"; |
58 |
if ($max_items > 0) $max_items--; |
if ($max_items > 0) $max_items--; |
59 |
} |
} |
60 |
else if ($name == "link") echo "</a>"; |
else if ($name == "link") { |
61 |
|
if ($current_tag_body_is_empty) echo $current_link_ref; |
62 |
|
echo "</a>"; |
63 |
|
$current_link_ref = ""; // reset |
64 |
|
} |
65 |
else if ($name == "list") echo "</ul>"; |
else if ($name == "list") echo "</ul>"; |
66 |
else if ($name == "li") echo "</li>"; |
else if ($name == "li") echo "</li>"; |
67 |
} |
} |
68 |
|
|
69 |
function characterData($parser, $data) { |
function characterData($parser, $data) { |
70 |
global $max_items; |
global $max_items; |
71 |
|
global $current_tag; |
72 |
|
global $current_tag_body_is_empty; |
73 |
|
|
74 |
|
$current_tag_body_is_empty = false; |
75 |
|
|
76 |
if ($max_items == 0) return; |
if ($max_items == 0) return; |
77 |
|
|
78 |
echo $data; |
echo $data; |