コード例 #1
0
ファイル: atom.php プロジェクト: hubgit/playr
$result = $db->query("SELECT * FROM playlists ORDER BY id DESC LIMIT 10");
$now = time();
$feed = new Atom('Playr: New Playlists', array('name' => 'Playr'), array('link' => array('text/html' => 'http://playr.hubmed.org/new.php')));
while ($item = mysql_fetch_object($result)) {
    $flash_params['playlistfile'] = play_url('xspf', $item->url);
    $entry = $feed->addEntry('tag:playr.hubmed.org,2005:atom,' . $item->id, $item->title, $now, NULL, array('link' => array('text/html' => $item->url)));
    $content = $feed->addContent($entry);
    $p = $feed->addTextChild($content, 'p', 'Play ');
    $a = $feed->addTextChild($p, 'a', 'Flash');
    $a->setAttribute('href', url(FLASH_PLAYER, $flash_params));
    $p = $feed->dom->createElement('p');
    $content->appendChild($p);
    $a = $feed->addTextChild($p, 'a', 'Original page');
    $a->setAttribute('href', $item->url);
}
$feed->output();
?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>Playr: New Playlists</title>
    <subtitle>New Playlists</subtitle>
    <id>tag:playr.hubmed.org,2005:new</id>
    <link rel="alternate" type="text/html" href="http://playr.hubmed.org/new.php" />
    <link rel="self" type="application/atom+xml" href="http://projects.hubmed.org/playr/atom.php"/>
    <author>
      <name>Playr</name>
      <email>alf@hubmed.org</email>
    </author>
    <icon>http://playr.hubmed.org/favicon.ico</icon>
    <updated><?php 
print $date;
?>