Hi, every bakers.
I am trying to create a RSS feed for my App. I was trying to use the
FeedCreator from the blog_tutorial_2. I got everything right. I can
brower like http://localhost/cake/posts/rss, the my FF 2.0 can detect
the rss and also I can save it in my bookmarks in FF.
BUT it contains nothing beside the title of the feed.
I use the debug($data), I can get a array back. So, the $data contains
data. BUT, why my feed contains nothing?
Thanks.
P.S. My code below.
-----------------------------------------views/posts/rss.thtml------------
<?php
vendor("feedcreator.class");
$rss = new UniversalFeedCreator();
$rss->title = "my title";
$rss->description = "my description";
$rss->link = "my link";
$rss->syndicationURL = "my syndication url";
// Initialize the cssStyleSheet var, needed to avoid an error with
FeedCreator version 1.7.2-mod (latest version at time of writing)
$rss->cssStyleSheet = "";
foreach ($data as $post)
{
$item = new FeedItem();
$item->title = $post['Post']['title'];
$item->link = "link";
$item->description = $post['Post']['body'];
$newdate = $post['Post']['created'];
list($date,$hours) = split(' ', $newdate);
list($year,$month,$day) = split('-', $date);
list($hour,$min,$sec) = split(':', $hours);
$date = date("r", mktime($hour, $min, $sec, $month, $day,
$year));
$item->date = $date;
$item->source = "source";
$item->author = "author";
$rss->addItem($item);
}
$rss->outputFeed();
?>
-----------controllers/posts_controller.php----------------------
function rss()
{
$this->layout = 'rss';
$this->set('data', $data = $this->Post->findAll(
null,
null,
null, // Sort order
5 // Number to be returned
));
}
---------------------layout/rss.thtml-------------
<?php echo $content_for_layout;?>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Cake PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---