rss-class
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
class rss
{
function rss($title,$link,$desc,$lang = 'nl-nl',$back = 0)
{
$this->$back = $back;
$this->$out = '';
$this->$out .= ('<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">');
$this->$out .= ('<channel><title>'.$title.'</title><link>'.$link.'</link>'.
'<description>'.$desc.'</description>');
}
function add_item($title,$link,$desc,$author,$date)
{
$this->$out .= ('<item><title>'.$title.'</title><link>'.$link.'</link>'.
'<description>'.$desc.'</description><dc:creator>'.$author.'</dc:creator>'.
'<pubdate>'.$date.'</dc:date></item>');
}
function add_by_array($info)
{
foreach($info as $item)
{
$this->$out .= ('<item><title>'.$item['title'].'</title><link>'.$item['link'].'</link>'.
'<description>'.$item['desc'].'</description>'.
'<dc:creator>'.$item['author'].'</dc:creator>'.
'<pubdate>'.$item['date'].'</dc:date></item>');
}
}
function flush($direct)
{
if ($direct) { header('Content-Type: text/xml'); }
echo($this->$out.'</channel></rss>');
}
function content()
{
return($this->$out);
}
}
?>
class rss
{
function rss($title,$link,$desc,$lang = 'nl-nl',$back = 0)
{
$this->$back = $back;
$this->$out = '';
$this->$out .= ('<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">');
$this->$out .= ('<channel><title>'.$title.'</title><link>'.$link.'</link>'.
'<description>'.$desc.'</description>');
}
function add_item($title,$link,$desc,$author,$date)
{
$this->$out .= ('<item><title>'.$title.'</title><link>'.$link.'</link>'.
'<description>'.$desc.'</description><dc:creator>'.$author.'</dc:creator>'.
'<pubdate>'.$date.'</dc:date></item>');
}
function add_by_array($info)
{
foreach($info as $item)
{
$this->$out .= ('<item><title>'.$item['title'].'</title><link>'.$item['link'].'</link>'.
'<description>'.$item['desc'].'</description>'.
'<dc:creator>'.$item['author'].'</dc:creator>'.
'<pubdate>'.$item['date'].'</dc:date></item>');
}
}
function flush($direct)
{
if ($direct) { header('Content-Type: text/xml'); }
echo($this->$out.'</channel></rss>');
}
function content()
{
return($this->$out);
}
}
?>