Beispiel #1
0
								FROM post 
								LEFT JOIN category ON category_id = post_category_id 
								WHERE post_valid=1 
								LIMIT 10');
    while ($row = mysql_fetch_object($request)) {
        // Creating a new feed item
        $rssItem = new Item();
        $rssItem->setTitle($row->post_title);
        $rssItem->setDescription($row->post_description);
        $rssItem->setLink('http://www.mywebsite.com/blog/post.php?id=' . $row->post_id);
        $rssItem->setGuid('http://www.mywebsite.com/blog/post.php?id=' . $row->post_id, true);
        $rssItem->setComments('http://www.mywebsite.com/blog/post.php?id=' . $row->post_id . '#comments');
        $rssItem->setAuthor($row->post_author_email, $row->post_author_name);
        $rssItem->setPubDate($row->post_date);
        $rssItem->setSource($row->post_source_uri, $row->post_source_name);
        $rssItem->setEnclosure('http://www.mywebsite.com/blog/images/nopicture.jpg', 2800, 'image/jpg');
        $rssItem->setCategory('http://www.mywebsite.com/blog/category.php.idCat=' . $row->category_id, $row->category_name);
        // Add the item to the feed
        $rssFeed->appendItem($rssItem);
    }
    // Save the feed
    $rssFeed->save();
    // SQL connection closing
    mysql_close();
    // Send headers to the browser
    header('Content-Type: text/xml; charset=utf-8');
    // Display the feed
    $rssFeed->display();
} catch (RSSFeedException $e) {
    echo $e->getErrorMessage();
}
Beispiel #2
0
    $oRssItem->setTitle('Le cahier de textes est vide');
    $oRssItem->setDescription('Rien à afficher -> Il faut toujours revoir les leçons du jour.');
    $oRssItem->setLink($ServerProtocole . $_SERVER["SERVER_NAME"] . $gepiPath . '/login.php');
    $oRssItem->setGuid($ServerProtocole . $_SERVER["SERVER_NAME"] . $gepiPath . '/login.php', true);
    if (!empty($sEmail)) {
        $oRssItem->setAuthor($sEmail, 'ADMIN');
    }
    $oRssItem->setPubDate(date("Y-m-d h:i:s"));
    $oRssFeed->appendItem($oRssItem);
    $oRssItem = null;
} else {
    // Récupération de l'email
    //$sEmail = getSettingValue("gepiSchoolEmail");
    $sEmail = $rss_email_defaut;
    $oRssItem = new RSSFeedItem();
    $oRssItem->setTitle('ERREUR sur le CDT');
    $oRssItem->setDescription('Rien à afficher -> Il faut toujours apprendre les leçons du jour.');
    $oRssItem->setLink($ServerProtocole . $_SERVER["SERVER_NAME"] . $gepiPath . '/login.php');
    $oRssItem->setGuid($ServerProtocole . $_SERVER["SERVER_NAME"] . $gepiPath . '/login.php', true);
    if (!empty($sEmail)) {
        $oRssItem->setAuthor($sEmail, 'ADMIN');
    }
    $oRssItem->setPubDate(date("Y-m-d h:i:s"));
    $oRssFeed->appendItem($oRssItem);
    $oRssItem = null;
}
// Sauvegarde du flux RSS
$oRssFeed->save('../temp/rss-news.xml');
// Affichage sur la sortie standard
header('Content-Type: text/xml; charset=UTF-8');
$oRssFeed->display();