iantearle.com

RSS Grabing Code

Grab any RSS from another domain and publish it in any fashion you wish on your Dreamscape CMS website.

//RSS grabbing code
include(EXPANSEPATH.'/funcs/snoopy.class.php');
include(EXPANSEPATH.'/funcs/rss.class.php');
$rss = new easyRSS;
function get_feeds($feed, $loop_name, $limit=10){
global $rss;
$news = array('items'=>array());
if(!isset($_SESSION[$loop_name])){
$feed_file = getRemoteFile($feed);
$news = $_SESSION[$loop_name] = $rss->parse($feed_file->results, "Y-m-d H:i:s");
} else {
$news = $_SESSION[$loop_name];
}
$content = array();
$news['items'] = array_slice($news['items'], 0, $limit);
foreach($news['items'] as $k => $v){
$content[] = (object) $v;
}
add_loop($content, $loop_name);
}

Then call the above script by adding the loop:

add_loop('http://blog.iantearle.com/feed.php?feed=atom', 'blog_rss');

Posted On: Friday, February 13th, 2009 @ 7:06 pm by Ian Tearle


0 Comments

There are no comments on this entry. You should add one below.

Leave a comment

Be kind

If you would like to discuss anything about this post, please be polite and add your comments below.


 
 

Additionally

No HTML is allowed. All links, and new lines will be automagically converted to HTML for you.
Notice to spammers, all links will be sanitized with rel="nofollow".


Contact Me

Get In Touch

If you would like to discuss anything about your next project please drop me a line.


 

Prices

Projects start at £99.00 per month
We normally book 2–3 months in advance.

Additionally

No matter how small your project is, or if the prices above scare you, please do get in touch, I shall always listen and will advise freely alternative ideas or solutions. If you are a charity, let's talk!


Find Me On