Quantcast
Channel: Zend_Feed_Rss Manipulation for Magento newsfeed - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Zend_Feed_Rss Manipulation for Magento newsfeed

$
0
0

I have created a newsfeed in my magento site using Zend Framework. This works almost perfectly except, I want to retrieve only the first 3 entries on the rss. If I try to do this, the first 3 items are displayed on my site but the foreach loop continues to execute so excess spaces and html elements are added in my site. How can I retrieve only the first 3 entries of the rss? Here's how my code looks:

<?php $i = 0;<?php $channel = new Zend_Feed_Rss('http://mydomain/newsfeed'); ?><?php foreach ($channel as $item): <div>if($i<3): ?><label>My feed title is: <?php echo $item->title; ?><?php endif; $i = $i + 1; ?></div><?php endforeach; ?>

I have about 10 entries on the newsfeed so if I execute something like this, I get the first 3 properly, then I get 7 excess labels with My feed title is:. I tried, using break but this broke my entire page so I can't use that. Can someone please guide me to the right direction?


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images