本文整理汇总了PHP中RSSFeed::appendItem方法的典型用法代码示例。如果您正苦于以下问题:PHP RSSFeed::appendItem方法的具体用法?PHP RSSFeed::appendItem怎么用?PHP RSSFeed::appendItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RSSFeed
的用法示例。
在下文中一共展示了RSSFeed::appendItem方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: while
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();
}
示例2: filesize
if ($loop == 0) {
$oRssItem->setEnclosure($url_doc_courant, filesize($items["cdt_dev"][$a]["doc_joint"][$loop]['emplacement']), $mimeType);
} else {
$tab_autres_docs_joints[] = array($url_doc_courant, filesize($items["cdt_dev"][$a]["doc_joint"][$loop]['emplacement']), $mimeType);
}
}
}
}
$oRssItem->setDescription($contenu_courant);
$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", $items["cdt_dev"][$a]["date_ct"]));
$oRssFeed->appendItem($oRssItem);
$oRssItem = null;
if (count($tab_autres_docs_joints) > 0) {
for ($loop = 0; $loop < count($tab_autres_docs_joints); $loop++) {
$oRssItem = new RSSFeedItem();
$oRssItem->setTitle($donnees["description"] . ' - Pour le ' . date("d-m-Y", $items["cdt_dev"][$a]["date_ct"]));
$contenu_courant = '-> Travail donné par ' . $prof . ' : ' . $items["cdt_dev"][$a]["contenu"];
$contenu_courant = '-> Document joint';
$oRssItem->setEnclosure($tab_autres_docs_joints[$loop][0], $tab_autres_docs_joints[$loop][1], $tab_autres_docs_joints[$loop][2]);
$oRssItem->setDescription($contenu_courant);
$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", $items["cdt_dev"][$a]["date_ct"]));