1 | <?php
|
---|
2 | header("Content-Type: text/xml"); // Nutné pokud soubor nemá pøíponu .xml
|
---|
3 | include 'includes/Configuration.php'; //nastavení
|
---|
4 | include 'includes/DatabaseConection.php'; //tøída databáze
|
---|
5 | $db = new Database($DatabaseAddres,$DatabaseUser,$DatabasePass); //vytvoøení promìné a pøipojení do databáze
|
---|
6 | $db->SelectDatabase($DatabaseName); //nastavení databáze
|
---|
7 | // $db->SQLCommand('SET character_set_results='.$CharSET);
|
---|
8 | // $db->SQLCommand('SET character_set_connection='.$CharSET);
|
---|
9 | // $db->SQLCommand('SET character_set_client='.$CharSET);
|
---|
10 | $db->SQLCommand('SET NAMES '.$CharSET);
|
---|
11 | // $db->SQLCommand('SET CHARACTER SET '.$CharSET);
|
---|
12 |
|
---|
13 | function GetHtmlChar($TestString)
|
---|
14 | { // BEGIN function GetHtmlChar
|
---|
15 | $TestString=str_replace("\r", "", $TestString);
|
---|
16 | $TestString=str_replace("\n", "<br>", $TestString);
|
---|
17 | //str_replace("\r", "<br>", $Line[2])
|
---|
18 | $TestString = htmlspecialchars($TestString);
|
---|
19 | return $TestString;
|
---|
20 | } // END function GetHtmlChar
|
---|
21 |
|
---|
22 |
|
---|
23 | echo '<?xml version="1.0" encoding="windows-1250" ?';
|
---|
24 | echo ">";
|
---|
25 | echo '
|
---|
26 | <rss version="2.0">
|
---|
27 | <channel>
|
---|
28 | <title>Obec Zdìchov - novinky</title>
|
---|
29 | <link>http://obec.zdechov.net</link>
|
---|
30 | <description>Aktuality webové stránky obec.zdechov.net</description>
|
---|
31 | <language>cs</language>
|
---|
32 | <pubDate>Tue, 31 Jul 2007 14:06:06 +0200</pubDate>
|
---|
33 | <webMaster>maron2@centrum.cz</webMaster>
|
---|
34 | <ttl>20</ttl>';
|
---|
35 |
|
---|
36 | $sql = "SELECT * FROM news order by 3 DESC LIMIT 10";
|
---|
37 | $ID = $db->SQLCommand($sql);
|
---|
38 | while($Line = mysql_fetch_array($ID)) {
|
---|
39 | echo '
|
---|
40 | <item>
|
---|
41 | <title>'.$Line['Name'].'</title>
|
---|
42 | <pubDate>'.$Line['Date'].'</pubDate>
|
---|
43 | <author>'.$Line['User'].'</author>
|
---|
44 | <link>http://obec.zdechov.net</link>
|
---|
45 | <description>'.GetHtmlChar($Line['Text']).'</description>
|
---|
46 | </item>';
|
---|
47 | } //
|
---|
48 | echo '
|
---|
49 | </channel>
|
---|
50 | </rss>';
|
---|
51 | ?>
|
---|