summaryrefslogtreecommitdiffstats
path: root/apis/news.inc.php
diff options
context:
space:
mode:
authorJonathan Bauer2014-06-05 17:37:37 +0200
committerJonathan Bauer2014-06-05 17:37:37 +0200
commit49af56d7262c58e79a67ad2f6d3ef02b9a05cbd6 (patch)
tree8e4140d866229c0bb91840e611805a17c9caebde /apis/news.inc.php
parentupdate 3 : news table (diff)
downloadslx-admin-49af56d7262c58e79a67ad2f6d3ef02b9a05cbd6.tar.gz
slx-admin-49af56d7262c58e79a67ad2f6d3ef02b9a05cbd6.tar.xz
slx-admin-49af56d7262c58e79a67ad2f6d3ef02b9a05cbd6.zip
news api for vmchooser2
Diffstat (limited to 'apis/news.inc.php')
-rw-r--r--apis/news.inc.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/apis/news.inc.php b/apis/news.inc.php
new file mode 100644
index 00000000..344c0104
--- /dev/null
+++ b/apis/news.inc.php
@@ -0,0 +1,23 @@
+<?php
+
+header('Content-Type: application/xml; charset=utf-8');
+
+// Fetch news from DB
+$row = Database::queryFirst('SELECT title, content, dateline FROM news ORDER BY dateline DESC LIMIT 1');
+if ($row !== false ) {
+
+ echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
+ echo "<news>" . "\n";
+ echo "\t" . '<headline>' . "\n";
+ echo "\t\t" . $row['title'] . "\n";
+ echo "\t" . '</headline>' . "\n";
+ echo "\t" . "<info>" . "\n";
+ echo "\t\t" . $row['content'] . "\n";
+ echo "\t" . '</info>' . "\n";
+ echo "\t" . "<date>" . "\n";
+ echo "\t\t" . $row['dateline'] . "\n";
+ echo "\t" . "</date>" . "\n";
+ echo "</news>";
+
+}
+