1 <define-tag insertnews>
2 <when <string-eq "$(WML_GEN_HOSTNAME)" "luonnotar">>
3 <h3 class=newstitle>Latest News</h3>
5 $dbh = pg_pconnect ("<dbhost>", "<dbport>", "<dbname>");
8 $query = "SELECT id,subject,releasedate,teaser,body FROM news "
9 . "WHERE deleted = 0 AND releasedate < now() AND teaser <> '' "
10 . "ORDER BY releasedate DESC,insertd DESC LIMIT 7";
11 $sth = pg_exec ($dbh, $query);
13 for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
14 $row = pg_fetch_array ($sth, $nr);
16 $date = explode (" ", $row['releasedate']);
17 if ("<get-var WML_SRC_BASENAME>" == "index.html.de") {
18 $date = explode ("-", $date[0]);
19 $date = sprintf ("%d.%d.%d", $date[2], $date[1], $date[0]);
23 if (!strcmp(substr($row['body'],0,7), 'http://'))
26 $url = sprintf ("/News/shownews.php?id=%d", $row['id']);
28 echo ("<div class=\"newsbox\">");
30 if (strlen ($row['body']) > 0)
31 //printf ("<strong><a href=\"%s\">%s</a></strong>",
32 printf ("<a href=\"%s\">%s</a>",
33 $url, $row['subject']);
35 printf ("<strong>%s</strong>", $row['subject']);
37 printf ("<br><span class=\"attribution\">%s</span></div>",
47 <menu-item text="Home" base="index.html" href="index.html">
48 <menu-item text="Search" base="search.html" href="search.html">
51 <ifeq <get-var WML_SRC_BASENAME> "index.html.de" "<insertnews de>">
52 <ifeq <get-var WML_SRC_BASENAME> "index.html.en" "<insertnews en>">