Irish SEO,  Marketing & Webmaster Discussion

 

Setting up rss feeds

This is a discussion on Setting up rss feeds within the Coding Help forums, part of the Webmaster Help category; Hello, I've been trying to figure out the basics of setting up a simple rss feed from, say, the BBC, ...


Go Back   Irish SEO, Marketing & Webmaster Discussion > Webmaster Help > Coding Help

Register Forum Rules FAQDonate Members List Calendar Search Today's Posts Mark Forums Read


Notices

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 20-12-2007, 11:46 AM
Frontpage User
 
Join Date: Dec 2007
Posts: 24
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
Big D will become famous soon enough
Default Setting up rss feeds

Hello,

I've been trying to figure out the basics of setting up a simple rss feed from, say, the BBC, on a .php page, but having gone through umpteen articles on the net I am going round in circles.

I cannot figure out what I am meant to be creating file-wise to upload to site - and where - and what actually goes in the particular page I want the feed to appear on.

If anyone can help me along the way with this one I'd be very grateful.

Big D.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 20-12-2007, 12:31 PM
Forbairt's Avatar
respect my AW-THOR-IT-AYY
 
Join Date: Jun 2007
Location: My Office, Dublin
Posts: 1,775
Nominated 2 Times in 1 Post
TOTW/F/M Award(s): 0
Forbairt has a reputation beyond reputeForbairt has a reputation beyond reputeForbairt has a reputation beyond reputeForbairt has a reputation beyond reputeForbairt has a reputation beyond reputeForbairt has a reputation beyond reputeForbairt has a reputation beyond reputeForbairt has a reputation beyond reputeForbairt has a reputation beyond reputeForbairt has a reputation beyond reputeForbairt has a reputation beyond repute
Send a message via AIM to Forbairt Send a message via MSN to Forbairt Send a message via Yahoo to Forbairt Send a message via Skype™ to Forbairt
Default

various ways you can go about this really ...

url =
BBC News | News Front Page | World Edition

get yourself
Magpie RSS - PHP RSS Parser

read the documentations .. and away you go ?
__________________
Forbairt Media | Web Design & Development Galway / Dublin, Ireland - coming soon ... ( vague but descriptive isn't it )
Recent Work: Safari Club African Safari Holidays - South Africa Safaris
Other Stuff: FluffyLinkulator Rapid Inclusion Service Tools
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 20-12-2007, 12:34 PM
Forbairt's Avatar
respect my AW-THOR-IT-AYY
 
Join Date: Jun 2007
Location: My Office, Dublin
Posts: 1,775
Nominated 2 Times in 1 Post
TOTW/F/M Award(s): 0
Forbairt has a reputation beyond reputeForbairt has a reputation beyond reputeForbairt has a reputation beyond reputeForbairt has a reputation beyond reputeForbairt has a reputation beyond reputeForbairt has a reputation beyond reputeForbairt has a reputation beyond reputeForbairt has a reputation beyond reputeForbairt has a reputation beyond reputeForbairt has a reputation beyond reputeForbairt has a reputation beyond repute
Send a message via AIM to Forbairt Send a message via MSN to Forbairt Send a message via Yahoo to Forbairt Send a message via Skype™ to Forbairt
Default

should add
Code:
require_once 'rss_fetch.inc';

$url = 'http://magpie.sf.net/samples/imc.1-0.rdf';
$rss = fetch_rss($url);

echo "Site: ", $rss->channel['title'], "<br>
";
foreach ($rss->items as $item ) {
	$title = $item[title];
	$url   = $item[link];
	echo "<a href=$url>$title</a></li><br>
";
}
You may also want to download the rss feed to your site and refresh it on intervals of 5 minutes 10 minutes so that you don't end up hammering the bbc website

for example if you site gets hit once a minute ... that'd be 60 hits to the BBC ... if you site gets hit 10 times a minute .. it'd be 600 hits .. and so on ... so the bbc may not like you doing that

You'll also be required to link back to their site / articles and give your source in most cases
__________________
Forbairt Media | Web Design & Development Galway / Dublin, Ireland - coming soon ... ( vague but descriptive isn't it )
Recent Work: Safari Club African Safari Holidays - South Africa Safaris
Other Stuff: FluffyLinkulator Rapid Inclusion Service Tools
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 20-12-2007, 01:05 PM
Frontpage User
 
Join Date: Dec 2007
Posts: 24
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
Big D will become famous soon enough
Default MagpieRSS

Forbairt, thank you for your reply.

I've just posted a message in the General chat section to explain that I've had to learn on the hoof since I lost my webmaster of 10 years, so there are still gaping holes in my knowledge.

However, it looks as though Magpierss has already been placed on my site for a feed set up by my former webmaster.

I notice there are 4 rss files in the directory:

rss.php
rss_cache.inc
rss_fetch.inc
rss_parse.inc

and the rss.php file reads as follows:

<?php
require_once 'rss_fetch.inc';
$url = 'http://news.bbc.co.uk/rss/newsonline_uk_edition/northern_ireland/rss091.xml';
$rss = fetch_rss($url);
$id=0;
echo "Site: ", $rss->channel['title'], "<br>\n";
foreach ($rss->items as $item ) {
if($id=="5") {
echo "</td><td><p>\n";
}
if($id=="10") {
echo "</td><td><p>\n";
}
if($id=="15") {
break;
}
$id++;
$title = $item[title];
$url = $item[link];
$description = $item[description];
echo "<a href=$url>$title</a><br>$description</li><br>\n";
}
?>

What I can't figure out is what code I should put in the page on which I would like the feed to appear, i.e. how do I activate the feed on a given web page?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 20-12-2007, 01:17 PM
Forbairt's Avatar
respect my AW-THOR-IT-AYY
 
Join Date: Jun 2007
Location: My Office, Dublin
Posts: 1,775
Nominated 2 Times in 1 Post
TOTW/F/M Award(s): 0
Forbairt has a reputation beyond reputeForbairt has a reputation beyond reputeForbairt has a reputation beyond reputeForbairt has a reputation beyond reputeForbairt has a reputation beyond reputeForbairt has a reputation beyond reputeForbairt has a reputation beyond reputeForbairt has a reputation beyond reputeForbairt has a reputation beyond reputeForbairt has a reputation beyond reputeForbairt has a reputation beyond repute
Send a message via AIM to Forbairt Send a message via MSN to Forbairt Send a message via Yahoo to Forbairt Send a message via Skype™ to Forbairt
Default

create a new file just to test its all working "filename.php"

put all your code into it I've simplified it slightly ... I think this code was being included as part of another file.


Code:
<?php

require_once 'rss_fetch.inc';

$url = 'http://news.bbc.co.uk/rss/newsonline_uk_edition/northern_ireland/rss091.xml';
$rss = fetch_rss($url);

echo "Site: ", $rss->channel['title'], "<br>\n";

foreach ($rss->items as $item ) {

 $title = $item[title];
 $url   = $item[link];
 $description   = $item[description];
 echo "<a href=$url>$title</a><br>$description</li><br>\n";

}

?>
once you know this is working ...

anywhere you want this to appear you could just put the code
<?PHP include "filename.php"; ?>
__________________
Forbairt Media | Web Design & Development Galway / Dublin, Ireland - coming soon ... ( vague but descriptive isn't it )
Recent Work: Safari Club African Safari Holidays - South Africa Safaris
Other Stuff: FluffyLinkulator Rapid Inclusion Service Tools
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6 (permalink)  
Old 20-12-2007, 01:39 PM
Frontpage User
 
Join Date: Dec 2007
Posts: 24
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
Big D will become famous soon enough
Default Well done!

Forbairt, thank you very much for that - I have it working!

Just a couple of quickies:

1. Can these feeds be styled with css?
2. Presumably the feed source can simply be changed by changing the URL?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7 (permalink)  
Old 20-12-2007, 01:56 PM
Forbairt's Avatar
respect my AW-THOR-IT-AYY
 
Join Date: Jun 2007
Location: My Office, Dublin
Posts: 1,775
Nominated 2 Times in 1 Post
TOTW/F/M Award(s): 0
Forbairt has a reputation beyond reputeForbairt has a reputation beyond reputeForbairt has a reputation beyond reputeForbairt has a reputation beyond reputeForbairt has a reputation beyond reputeForbairt has a reputation beyond reputeForbairt has a reputation beyond reputeForbairt has a reputation beyond reputeForbairt has a reputation beyond reputeForbairt has a reputation beyond reputeForbairt has a reputation beyond repute
Send a message via AIM to Forbairt Send a message via MSN to Forbairt Send a message via Yahoo to Forbairt Send a message via Skype™ to Forbairt
Default

Quote:
Originally Posted by Big D View Post
Forbairt, thank you very much for that - I have it working!

Just a couple of quickies:

1. Can these feeds be styled with css?
2. Presumably the feed source can simply be changed by changing the URL?
Code:
echo "<a href=$url>$title</a><br>$description</li><br>\n";
there you have your link urls so yes you just have to give them a class or put the whole thing in a container div ? ... for example

Code:
<div class="rssFeed">
...
...
</div>
then its just down to you to style the output



I'd almost recommend you remove the $url bit from your include file

then when ever you want to include a rss feed
Code:
<?PHP
$url = "http://www.myurlformyrssfeed.com/my.rss";
include "filename.php"
?>
__________________
Forbairt Media | Web Design & Development Galway / Dublin, Ireland - coming soon ... ( vague but descriptive isn't it )
Recent Work: Safari Club African Safari Holidays - South Africa Safaris
Other Stuff: FluffyLinkulator Rapid Inclusion Service Tools
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8 (permalink)  
Old 20-12-2007, 02:16 PM
Frontpage User
 
Join Date: Dec 2007
Posts: 24
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
Big D will become famous soon enough
Default One very last question in meantime

Right, I've managed to get the thing going and have styled it a bit with css, but the feed is pretty long - what way - if any - is there of controlling the number of items in the feed?

Until I get familiar with what each piece of the code does and get more adept at rss feeds generally I will almost certainly require more help, but I have to say that I do really appreciate your helpfulness.

To show my good faith in the meantime would a link from my website Library Ireland: Irish History and Culture to your site be of any use?

Big D.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9 (permalink)  
Old 20-12-2007, 02:25 PM
Forbairt's Avatar
respect my AW-THOR-IT-AYY
 
Join Date: Jun 2007
Location: My Office, Dublin
Posts: 1,775
Nominated 2 Times in 1 Post
TOTW/F/M Award(s): 0
Forbairt has a reputation beyond reputeForbairt has a reputation beyond reputeForbairt has a reputation beyond reputeForbairt has a reputation beyond reputeForbairt has a reputation beyond reputeForbairt has a reputation beyond reputeForbairt has a reputation beyond reputeForbairt has a reputation beyond reputeForbairt has a reputation beyond reputeForbairt has a reputation beyond reputeForbairt has a reputation beyond repute
Send a message via AIM to Forbairt Send a message via MSN to Forbairt Send a message via Yahoo to Forbairt Send a message via Skype™ to Forbairt
Default

Quote:
Originally Posted by Big D View Post
Right, I've managed to get the thing going and have styled it a bit with css, but the feed is pretty long - what way - if any - is there of controlling the number of items in the feed?

Until I get familiar with what each piece of the code does and get more adept at rss feeds generally I will almost certainly require more help, but I have to say that I do really appreciate your helpfulness.

To show my good faith in the meantime would a link from my website Library Ireland: Irish History and Culture to your site be of any use?

Big D.
to control the number of items you could do something like this

Code:

$rss = fetch_rss($url);
$items = array_slice($rss->items, 0, 5);
where 5 is ... the number of items...


A link wouldn't hurt but isn't necessary
__________________
Forbairt Media | Web Design & Development Galway / Dublin, Ireland - coming soon ... ( vague but descriptive isn't it )
Recent Work: Safari Club African Safari Holidays - South Africa Safaris
Other Stuff: FluffyLinkulator Rapid Inclusion Service Tools
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10 (permalink)  
Old 20-12-2007, 03:16 PM
Frontpage User
 
Join Date: Dec 2007
Posts: 24
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
Big D will become famous soon enough
Default Number of items unaffected

Forbairt,

The array slice line hasn't affected the length of the feed - don't know whether I've done something wrong?--

Code:
<?php
require_once 'rss_fetch.inc';
$url = 'http://news.bbc.co.uk/rss/newsonline_uk_edition/northern_ireland/rss091.xml';
$rss = fetch_rss($url);
$items = array_slice($rss->items, 0, 5);
echo "Site: ", $rss->channel['title'], "<br>\n";
foreach ($rss->items as $item ) {
 $title = $item[title];
 $url   = $item[link];
 $description   = $item[description];
 echo "<a href=$url>$title</a><br>$description</li><br>\n";
}
?>
For what it might be worth I have set up a link to your site at the following url Free Irish Reference Works
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
feeds, rss, setting

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads

Thread Thread Starter Forum Replies Last Post
rss feed or newsletter Busarus Webmaster Discussion 4 02-03-2007 09:29 PM
RSS feeds ph3n0m Forum Feedback, Development and Competitions 6 31-01-2007 12:39 AM
1 Bag of RSS feed: 100% RDA of internet. Warning: may contain nut traces. gary.b General Chat 15 29-01-2007 10:03 PM
Web RSS readers Cormac Webmaster Discussion 3 18-10-2006 01:26 PM
rss feed louie General Chat 0 29-04-2006 08:18 PM


All times are GMT +1. The time now is 05:10 AM.


Powered by: vBulletin Version 3.7.3, Copyright ©2000 - 2008, Jelsoft Enterprises Limited.
Hosted in Ireland by Blacknight - Test your ISP |Irish Hosting Directory| Armchair.ie|Logo by Eden Web Design|Avatars by Afterglow |Latest Blog Entries | VPS HostingAd Management by RedTyger