All pastes #147764 Raw Edit

Mine

public text v1 · immutable
#147764 ·published 2006-08-24 16:54 UTC
rendered paste body
// grabbing the date
$date = date("D, d M G:i:s O");

// sending the xml header
header("Content-type: text/xml");

echo <<<EOF
<?xml version="1.0" encoding="utf-8"?>
<!-- generator="photoblog.com" -->
<rss version="2.0" 
        xmlns:content="http://purl.org/rss/1.0/modules/content/"
        xmlns:wfw="http://wellformedweb.org/CommentAPI/"
        xmlns:dc="http://purl.org/dc/elements/1.1/"
>

        <channel>
                <title>$user's Photoblog</title>
                <link>http://www.photoblog.com/user/$user</link>
                <description></description>
                <pubDate>$date</pubDate>

                <generator>http://photoblog.com</generator>
                <language>en</language>
EOF;


// seeing if the user is there first
$blogs = array();
$DB->query("SELECT title,photos,text,date,created,category FROM entries INNER JOIN members ON members.id=entries.userid WHERE M
ATCH(`username`) AGAINST('$user') ORDER BY date DESC LIMIT 10");
while ($row = $DB->fetch_array()) {
        $blogs[] = $row;
}

foreach ($blogs as $value) {
        $create = date("D, d M G:i:s O", $value['created']);

        // formating the link now
        list($y,$m,$d) = explode("-", $value['date']);
        $url = "http://www.photoblog.com/user/". $user ."/$y/$m/$d";

        $desc = htmlspecialchars(ellipsis($value['text'], 200));

        $value['title'] = htmlspecialchars($value['title']);

        $DB->query("SELECT name FROM categories WHERE id='{$value['category']}' LIMIT 1");
        $row = $DB->fetch_array();

        $row['name'] = htmlspecialchars($row['name']);


        echo <<<EOF

                <item>
                        <title>{$value['title']}</title>
                        <link>$url</link>
                        <comments>$url#comments</comments>

                        <pubDate>$create</pubDate>
                        <dc:creator>$user</dc:creator>

                        <category>{$row['name']}</category>
                        <guid>$url</guid>
                        <description>$desc</description>
                </item>
EOF;

        //<wfw:commentRSS>http://blog.meso.com/?feed=rss2&amp;p=42</wfw:commentRSS>

}


?>

        </channel>
</rss>