source: branches/old/administrace/rss_generator.php

Last change on this file was 389, checked in by george, 16 years ago
  • Upraveno: Kódování všech souborů webu bylo převedeno z ISO 8859-2 na obecné UTF-8.
File size: 1006 bytes
Line 
1<?php
2
3function GenerateRSS($Data)
4{
5 if(!array_key_exists('Charset', $Data)) $Data['Charset'] = 'utf-8';
6 $Result = '<?xml version="1.0" encoding="'.$Data['Charset'].'" ?>'."\n". //<?
7 '<rss version="2.0">'."\n".
8 " <channel>\n".
9 " <title>".$Data['Title']."</title>\n".
10 " <link>".$Data['Link']."</link>\n".
11 " <description>".$Data['Description']."</description>\n".
12 " <language>cs</language>\n".
13 " <webMaster>".$Data['WebmasterEmail']."</webMaster>\n".
14 " <pubDate>".date('r')."</pubDate>\n".
15 " <ttl>20</ttl>\n";
16 foreach($Data['Items'] as $Item)
17 {
18 $Result .= " <item>\n".
19 ' <title>'.htmlspecialchars($Item['Title'])."</title>\n".
20 ' <description>'.htmlspecialchars($Item['Description'])."</description>\n".
21 ' <pubDate>'.date('r',$Item['Time'])."</pubDate>\n".
22 ' <link>'.$Item['Link']."</link>\n".
23 " </item>\n";
24 }
25 $Result .= " </channel>\n".
26 "</rss>";
27 return($Result);
28}
29
30?>
Note: See TracBrowser for help on using the repository browser.