Hi, how can I insert images in my rss feed? I want one image to go
with each post.
Here's the basic setup:
foreach ($entries as $entry) {
$postTime = strtotime($entry['Entry']['created']);
$entryLink = array(
'controller' => 'entries',
'action' => 'view',
'year' => date('Y', $postTime),
'month' => date('m', $postTime),
'day' => date('d', $postTime),
$entry['Entry']['slug']);
// This is the part where we clean the body text for output as
the description
// of the rss item, this needs to have only text to make sure
the feed validates
$bodyText = preg_replace('=\(.*?)\=is', '', $entry['Entry']
['body']);
$bodyText = $text->stripLinks($bodyText);
$bodyText = Sanitize::stripAll($bodyText);
$bodyText = $text->truncate($bodyText, 400, '...', true,
true);
echo $rss->item(array(), array(
'title' => $entry['Entry']['title'],
'link' => $entryLink,
'guid' => array('url' => $entryLink, 'isPermaLink' =>
'true'),
'description' => $bodyText,
'dc:creator' => $entry['Entry']['author'],
'pubDate' => $entry['Entry']['created']));
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---