/[svn]/web/trunk/www.linuxsampler.org/news_internal.php
ViewVC logotype

Diff of /web/trunk/www.linuxsampler.org/news_internal.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1268 by schoenebeck, Tue Aug 7 19:56:17 2007 UTC revision 1409 by schoenebeck, Fri Oct 12 14:34:42 2007 UTC
# Line 5  $file = "news.xml"; Line 5  $file = "news.xml";
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_attribs = 0;
10    $current_tag_body_is_empty = true;
11    $current_link_ref = "";
12    
13  function startElement($parser, $name, $attribs) {  function startElement($parser, $name, $attribs) {
14      global $max_items;      global $max_items;
15        global $current_tag;
16        global $current_tag_body_is_empty;
17        global $current_link_ref;
18    
19      if ($max_items == 0) return;      if ($max_items == 0) return;
20    
21        array_push($current_tag, $name);
22    
23        $current_tag_body_is_empty = true;
24    
25      if ($name == "entry") {      if ($name == "entry") {
26          if (count($attribs) && isset($attribs["date"])) {          if (count($attribs) && isset($attribs["date"])) {
27              $d = $attribs["date"];              $d = $attribs["date"];
# Line 16  function startElement($parser, $name, $a Line 29  function startElement($parser, $name, $a
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      } else if ($name == "list") {      } else if ($name == "list") {
35          echo "<ul class=\"news\">";          echo "<ul class=\"news\">";
36      } else if ($name == "li") {      } else if ($name == "li") {
# Line 27  function startElement($parser, $name, $a Line 40  function startElement($parser, $name, $a
40    
41  function endElement($parser, $name) {  function endElement($parser, $name) {
42      global $max_items;      global $max_items;
43        global $current_tag;
44        global $current_tag_body_is_empty;
45        global $current_link_ref;
46    
47      if ($max_items == 0) return;      if ($max_items == 0) return;
48    
49        array_pop($current_tag);
50    
51      if ($name == "entry") { echo "</div>\n";      if ($name == "entry") { echo "</div>\n";
52          if ($max_items > 0) $max_items--;          if ($max_items > 0) $max_items--;
53      }      }
54      else if ($name == "link") echo "</a>";      else if ($name == "link") {
55            if ($current_tag_body_is_empty) echo $current_link_ref;
56            echo "</a>";
57            $current_link_ref = ""; // reset
58        }
59      else if ($name == "list") echo "</ul>";      else if ($name == "list") echo "</ul>";
60      else if ($name == "li") echo "</li>";      else if ($name == "li") echo "</li>";
61  }  }
62    
63  function characterData($parser, $data) {  function characterData($parser, $data) {
64      global $max_items;      global $max_items;
65        global $current_tag;
66        global $current_tag_body_is_empty;
67    
68        $current_tag_body_is_empty = false;
69    
70      if ($max_items == 0) return;      if ($max_items == 0) return;
71    
72      echo $data;      echo $data;

Legend:
Removed from v.1268  
changed lines
  Added in v.1409

  ViewVC Help
Powered by ViewVC