Re: Images in RSS Feed

2013-01-11 Thread TonyCharlotteCakePHP
I was taking a look at the RssHelper file and there is case for "enclosure" 
which is not documented but here's how it work:


set('channelData', array(
'title' => 'test',
'link' => 'test',
'url' => 'tes',
'description' => 'test',
'language' => 'en-us',
'managing-editor' => 'test',
));

foreach($posts as $post) {

// 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', '', 
$post['Post']['excerpt']);
$bodyText = $this->Text->stripLinks($bodyText);
$bodyText = Sanitize::stripAll($bodyText);
$bodyText = $this->Text->truncate($bodyText, 400, array(
'ending' => '...',
'exact'  => true,
'html'   => true,
));

echo $this->Rss->item(array(), array(
'title' => $post['Post']['title'],
'link' => array(
'controller' => 'streams',
'action' => 'view', $post['Post']['id']
),
'guid' => array(
'controller' => 'streams',
'action' => 'view', $post['Post']['id']
),
'description' => $bodyText,
'pubDate' => $post['Post']['post_date'],
'enclosure' => array('url' => 
$this->Html->url('/app/webroot/'.$post['Post']['image_site_thumb'], true), 
'width' => '140', 'height' => '100')
));
}
?>

I'm sure this can be done view the elem method but I'm not sure how to get 
that to work.


On Friday, January 11, 2013 1:37:19 PM UTC-5, TonyCharlotteCakePHP wrote:
>
> I'm having the same issue. I'm assuming it can be done via elem method of 
> the Rss Helper class. 
> http://api20.cakephp.org/file/Cake/View/Helper/RssHelper.php# (scroll 
> down to the Rss helper class info). Here's what I have in my rss.ctp file 
> but I can't get the elem method to work properly:
>
>
>  App::uses('Sanitize', 'Utility');
> 
> $this->set('channelData', array(
> 'title' => 'test',
> 'link' => 'test',
> 'url' => 'test',
> 'description' => 'test',
> 'language' => 'en-us',
> 'managing-editor' => 'test',
> ));
>
> foreach($posts as $post) {
> 
> // 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', '', 
> $post['Post']['excerpt']);
> $bodyText = $this->Text->stripLinks($bodyText);
> $bodyText = Sanitize::stripAll($bodyText);
> $bodyText = $this->Text->truncate($bodyText, 400, array(
> 'ending' => '...',
> 'exact'  => true,
> 'html'   => true,
> ));
> 
> echo $this->Rss->item(array(), array(
> 'title' => $post['Post']['title'],
> 'link' => array(
> 'controller' => 'streams',
> 'action' => 'view', $post['Post']['id']
> ),
> 'guid' => array(
> 'controller' => 'streams',
> 'action' => 'view', $post['Post']['id']
> ),
> 'description' => $bodyText,
> 'pubDate' => $post['Post']['post_date'],
> 'elem' => array('media:thumbnail', array('url' => 
> $this->Html->url('/app/webroot/'.$post['Post']['image_site_thumb'], true), 
> 'width' => '75', 'height' => '75'), NULL, false)
> ));
> }
> ?>
>
>  
>
> On Tuesday, April 17, 2012 4:21:48 AM UTC-4, Reza Talamkhani wrote:
>>
>> Hi, how can I insert images in my rss feed? I want one image to go
>> with each post.
>>
>> index.ctp
>>
>> > $this->set('documentData', array(
>> 'xmlns:dc' => 'http://purl.org/dc/elements/1.1/'));
>>
>> $this->set('channelData', array(
>> 'title' => __("پست های اخیر رضا تلم خانی"),
>> 'link' => $this->Html->url('/', true),
>> 'description' => __("وب سایت رسمی رضا تلم خانی"),
>> 'language' => 'fa'));
>>
>> App::uses('Sanitize', 'Utility');
>> foreach ($posts as $post) {
>> //$postTime = strtotime($post['Post']['created']);
>>
>> $postLink = array(
>> 'controller' => 'posts',
>> 'action' => 'view',
>> $post['Post']['id'],
>> //'year' => date('Y', $postTime),
>> //'month' => date('m', $postTime),
>> //'day' => date('d', $postTime),
>> //$post['Post']['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', '', $post['Post']['body']);
>> $bodyText = strip_tags($bodyText);
>> $bodyText = $this->Text->stripLinks($bodyText);
>> $bodyText = Sanitize::stripAll($bodyText)

Re: Images in RSS Feed

2013-01-11 Thread TonyCharlotteCakePHP
I'm having the same issue. I'm assuming it can be done via elem method of 
the Rss Helper class. 
http://api20.cakephp.org/file/Cake/View/Helper/RssHelper.php# (scroll down 
to the Rss helper class info). Here's what I have in my rss.ctp file but I 
can't get the elem method to work properly:


set('channelData', array(
'title' => 'test',
'link' => 'test',
'url' => 'test',
'description' => 'test',
'language' => 'en-us',
'managing-editor' => 'test',
));

foreach($posts as $post) {

// 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', '', 
$post['Post']['excerpt']);
$bodyText = $this->Text->stripLinks($bodyText);
$bodyText = Sanitize::stripAll($bodyText);
$bodyText = $this->Text->truncate($bodyText, 400, array(
'ending' => '...',
'exact'  => true,
'html'   => true,
));

echo $this->Rss->item(array(), array(
'title' => $post['Post']['title'],
'link' => array(
'controller' => 'streams',
'action' => 'view', $post['Post']['id']
),
'guid' => array(
'controller' => 'streams',
'action' => 'view', $post['Post']['id']
),
'description' => $bodyText,
'pubDate' => $post['Post']['post_date'],
'elem' => array('media:thumbnail', array('url' => 
$this->Html->url('/app/webroot/'.$post['Post']['image_site_thumb'], true), 
'width' => '75', 'height' => '75'), NULL, false)
));
}
?>

 

On Tuesday, April 17, 2012 4:21:48 AM UTC-4, Reza Talamkhani wrote:
>
> Hi, how can I insert images in my rss feed? I want one image to go
> with each post.
>
> index.ctp
>
>  $this->set('documentData', array(
> 'xmlns:dc' => 'http://purl.org/dc/elements/1.1/'));
>
> $this->set('channelData', array(
> 'title' => __("پست های اخیر رضا تلم خانی"),
> 'link' => $this->Html->url('/', true),
> 'description' => __("وب سایت رسمی رضا تلم خانی"),
> 'language' => 'fa'));
>
> App::uses('Sanitize', 'Utility');
> foreach ($posts as $post) {
> //$postTime = strtotime($post['Post']['created']);
>
> $postLink = array(
> 'controller' => 'posts',
> 'action' => 'view',
> $post['Post']['id'],
> //'year' => date('Y', $postTime),
> //'month' => date('m', $postTime),
> //'day' => date('d', $postTime),
> //$post['Post']['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', '', $post['Post']['body']);
> $bodyText = strip_tags($bodyText);
> $bodyText = $this->Text->stripLinks($bodyText);
> $bodyText = Sanitize::stripAll($bodyText);
> $bodyText = $this->Text->truncate($bodyText, 400, array(
> 'ending' => '...',
> 'exact'  => true,
> 'html'   => true,
> ));
>
> echo  $this->Rss->item(array(), array(
> 'title' => $post['Post']['title'],
> 'link' => $postLink,
> 'guid' => array('url' => $postLink, 'isPermaLink' => 'true'),
> 'description' => $bodyText,
> 'creator' => $post['User']['full_name'],
> 'pubDate' => $post['Post']['created'],
> ));
> }
>
> ?>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Images in RSS Feed

2012-04-17 Thread Reza Talamkhani
Hi, how can I insert images in my rss feed? I want one image to go
with each post.

index.ctp

set('documentData', array(
'xmlns:dc' => 'http://purl.org/dc/elements/1.1/'));

$this->set('channelData', array(
'title' => __("پست های اخیر رضا تلم خانی"),
'link' => $this->Html->url('/', true),
'description' => __("وب سایت رسمی رضا تلم خانی"),
'language' => 'fa'));

App::uses('Sanitize', 'Utility');
foreach ($posts as $post) {
//$postTime = strtotime($post['Post']['created']);

$postLink = array(
'controller' => 'posts',
'action' => 'view',
$post['Post']['id'],
//'year' => date('Y', $postTime),
//'month' => date('m', $postTime),
//'day' => date('d', $postTime),
//$post['Post']['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', '', $post['Post']['body']);
$bodyText = strip_tags($bodyText);
$bodyText = $this->Text->stripLinks($bodyText);
$bodyText = Sanitize::stripAll($bodyText);
$bodyText = $this->Text->truncate($bodyText, 400, array(
'ending' => '...',
'exact'  => true,
'html'   => true,
));

echo  $this->Rss->item(array(), array(
'title' => $post['Post']['title'],
'link' => $postLink,
'guid' => array('url' => $postLink, 'isPermaLink' => 'true'),
'description' => $bodyText,
'creator' => $post['User']['full_name'],
'pubDate' => $post['Post']['created'],
));
}

?>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: How to get images in RSS feed using RSShelper

2009-02-13 Thread RoVo

Hi majna,

I think, jorgtron wants a result like this:
http://www.w3schools.com/rss/rss_tag_image.asp

RoVo

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to get images in RSS feed using RSShelper

2009-02-13 Thread majna

Feed exmaple:

Title
http://example.com/news/view/1


 


On Feb 13, 9:28 am, "jorgt...@gmail.com"  wrote:
> anyone?
>
> On 12 Feb, 14:11, "jorgt...@gmail.com"  wrote:
>
> > 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 cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to get images in RSS feed using RSShelper

2009-02-13 Thread jorgt...@gmail.com

anyone?

On 12 Feb, 14:11, "jorgt...@gmail.com"  wrote:
> 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 cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



How to get images in RSS feed using RSShelper

2009-02-12 Thread jorgt...@gmail.com

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 cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---