Need help setting up an RSS feed.

Status
Not open for further replies.

The Walsho

New Member
Firstly, apologies if there's a more appropriate place for this thread.

I've set up RSS feeds before with wordpress and feedburner - couldn't be simpler.

I'm now looking to set one up for Home - Today I Lol'd and am completely at a loss as to how to do it. I know it can be done, as several websites using the same script have done it. (fmylife, givesmehope to name a few).

Anyone have any ideas?
 

Niche

New Member
If your site is not large you can create the RSS yourself using an html editor
 

php.allstar

New Member
Hi,

Here's a simple code snippet I use to create an ATOM RSS feed. This should point you in the right direction...

(*sorry I still can't figure out how to paste php code with syntax highlighting in to this forum..)

<?php

// Pass in an array of data...this array is up to you, pull it from mysql or web services or an xml file...lets call this array $myArray
// ...

// Create a date string for use later...
$now = date("D, d M Y H:i:s T");

// Starting output for the atom rss feed
$output = "<?xml version=\"1.0\"?>
<rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\">
<channel>
<title>[Your Feed Title]</title>
<link>[Your Website URL]</link>
<description>[A description of your RSS Feed]</description>
<language>en-gb</language>
<pubDate>$now</pubDate>
<lastBuildDate>$now</lastBuildDate>
<docs>[Your Domain]</docs>
<managingEditor>john@doe.com (John Doe)</managingEditor>
<webMaster>john@doe.com (John Doe)</webMaster>
<atom:link href=\"\" rel=\"self\" type=\"application/rss+xml\" />"; // Create a node for each news item foreach($myArray as $news){ $output .= ' <item> <title>' . $news['title'] . '</title> <description>' . $news['description'] . '</description> <link>' . $news['url'] . '</link> <guid>' . $news['url'] . '</guid> </item>'; } // Close the output $output .= "</channel></rss>"; // Tell the browser / reader that this is an rss feed header("Content-Type: application/rss+xml"); // Output the rss to browser/reader echo $output; ?> There are a ton of configuration deirectives you can add in for rss and even add images, but hey... this should be a good starting point for you... By the way, save the file as something like rss.php Good luck with it..
 

The Walsho

New Member
Thanks for both replies.

php.allstar, I'll give that a go later and let you know. So basically I'm making a file called rss.php and copying in that code (changing the relevant bits and pieces)?
 

php.allstar

New Member
Exactly!

You'll have to create an array called $myArray and populate it from your source...

You know yourself...

<?php

$myArray = array();

// Item 1...
$myArray['title'][] = 'My Story Title 1';
$myArray['content'][] = 'Lorem ipsum solor blah blah blah...';
$myArray['url'][] = 'http://www.domain.com/news/2009-08-19/lorem-ipsum-solor.....';

// Item 2...
$myArray['title'][] = 'My Story Title 2';
$myArray['content'][] = 'Lorem ipsum solor blah blah blah...';
$myArray['url'][] = 'http://www.domain.com/news/2009-08-19/lorem-ipsum-solor.....';

// And so on...

?>
 

php.allstar

New Member
Hiya,

Sorry, I can only give you so much free help I'm afraid! Anything more would mean me doing work for you for nothing! LOL ;)

Basically what I was tryig to say with the posts is that, you have to conenct to your information source, this could be an xml file, another rss feed, a database or web services.

Then with each news item within this data source, you have to populate a php array with the news stories from the source. There are plenty of other ways of doing this...

The code then loops through each news item in the array and generates the rss feed.

If you want someone to do the work for you, just ask and they can give you a price. There are plenty of people on here who would be more than willing to do this for you, it would only take 10 to 20 minutes to implement and would cost you no more than €20 to €40.

But by all means, learn how to do it yourself, thats how it all started for me! Jump in and get your hands dirty, the code I gave you should be a good starting point... its 90% there!

Good luck with it.
 

The Walsho

New Member
Thanks a lot php.allstar - really appreciate your help.

Sure I'll mess around and see if I get anywhere, if not I'll get the wallet out. Cheers :)
 

The Walsho

New Member
Alright lads, gave this a go tonight. My head is wrecked. Way out of my depth. I had a few moments where I thought I was close but alas, to no avail. I've learned a little something anyway, at least. Php.allstar, I'm sorry all the help you offered me seems to be in vain.

New stories are posted every day so the RSS feed would have to draw from the mySQL database. I had a look at the database and can see where the stories are, and the info for them and everything, I just don't know how to make the RSS file draw from this.

Anyone reckon they could do this job? I haven't much money right now but desperately want this feed set up so am willing to pay for it to be done. Please let me know.
 

php.allstar

New Member
Hiya,

Well I can do it, sent you a pm with price, just let me know if you want me to go ahead with a pm of exactly what you want pulled and access details for your ftp server and mysql database login details.

Thanks.
 
Status
Not open for further replies.
Award-winning Mac antivirus and Internet security software
Top