Exemple #1
0
            $players = "Unknown players";
        }
        $maker = $row["maker"];
        if ($maker == "") {
            $maker = "Unknown maker";
        }
        $link = "http://footbagisrael.com/videos/?id=" . $row["id"];
        $atomID = "tag:footbagisrael.com,2012-05-07:videos,?id=" . $row["id"];
        $date = $row["date"];
        if ($date == "0000-00-00 00:00:00") {
            $date = date(DateTime::ATOM);
            $mysqldate = date('Y-m-d H:i:s');
            $query = "UPDATE videos SET date='{$mysqldate}' WHERE id='{$row['id']}'";
            mysql_query($query);
        } else {
            $phpDate = strtotime($date);
            $date = date(DateTime::ATOM, $phpDate);
            $feedItems[] = array('title' => $row["title"], 'id' => $atomID, 'link' => $link, 'content' => $year . " at " . $location . ", made by " . $maker . " With " . $players, 'updated' => $date);
        }
    }
    $myatom->addItems($feedItems);
    $myatom->generateTags();
    $myatom->setProperty('category', 'sports');
    $myatom->setGenerator('PHP-Feed', '0.1', 'http://github.com/duckson/php-feed');
    $myatom->addAuthor('Roy Klein', 'http://footbagisrael.com', '*****@*****.**');
    $myatom->setProperty('rights', 'Copyleft 2012, Nobody');
    $myatom->setContentType('text/plain');
    $output = $myatom->fetch();
    header('Content-type: application/xml');
    echo $output;
}
Exemple #2
0
<?php

/**
 * @file demo-atom.php
 * Atom feed demo
 */
// Include the files
include 'classes/Feed.class.php';
include 'classes/RSS.class.php';
include 'classes/Atom.class.php';
// Set up a the Feed object
$myatom = new Atom('An Atom Feed', 'http://example.com/', 'Description of this feed.');
$feeditems = array(array('title' => 'Example item', 'link' => 'http://example.com/news/foo', 'content' => 'Content goes here.', 'published' => date(DateTime::ATOM, strtotime('17-09-2011 18:10')), 'updated' => date(DateTime::ATOM, strtotime('17-09-2011 21:30'))), array('title' => 'Another example item', 'link' => 'http://example.com/blog/bar', 'content' => 'Content goes here.', 'published' => date(DateTime::ATOM, strtotime('12-08-2011 12:53')), 'updated' => date(DateTime::ATOM, strtotime('13-08-2011 14:32')), 'author' => 'Henk Ankerman'), array('title' => 'Yet another example item', 'link' => 'http://example.com/2011/01/example-item', 'description' => 'Description goes here.', 'content' => 'Some content.', 'published' => date(DateTime::ATOM, strtotime('17-09-2011 21:30')), 'updated' => date(DateTime::ATOM, strtotime('18-09-2011 12:24'))), array('title' => 'Hallo Will', 'link' => 'http://test.nl/', 'published' => date(DateTime::ATOM, strtotime('16-09-2011 15:44'))));
// Add some feed items
$myatom->addItems($feeditems);
// Generate tag URI's for the Feed items
$myatom->generateTags();
// Add some properties
$myatom->setProperty('category', 'tech');
$myatom->setGenerator('PHP-Feed', '0.1', 'http://github.com/duckson/php-feed');
$myatom->addAuthor('Henk Ankerman', 'http://example.com/~henk/', '*****@*****.**');
$myatom->setProperty('rights', 'Copyleft 2011, Nobody');
// We're using text/plain here to make sure you can read the raw output
$myatom->setContentType('text/plain');
// Fetch the result into a variable
$output = $myatom->fetch();
echo $output;