By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,303 Members | 1,245 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,303 IT Pros & Developers. It's quick & easy.

help on integrating RSS in site done in php

P: n/a
hi guys,

i want to have rss on my site and the page is written in php
(mypage.php). what are the things i need? how to start to with it?

pls help..
tnx

Apr 30 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
shotokan99 wrote:
i want to have rss on my site and the page is written in php
(mypage.php). what are the things i need? how to start to with it?
Try my feed library...

http://svn.sourceforge.net/viewvc/de...ss?view=markup

Example of usage:

<?php

// This file is called "http://example.com/feed.xml"

// Load up the Feed library.

require 'Feed.class';

// Create a new feed.

$f = Feed::factory(
'rss2',
'Example.com News',
'http://example.com/feed.xml',
'All the latest news and greatest views from Example.com',
'en' #English
);

// You would normally want to read your news from a database and
// add each item to the feed. However, for simplicity I'll add a
// couple of news items without using a database.

$f->add_item(
'EXMP Shares Reach Record High',
'http://example.com/news/2007/share-price',
'News of the new chairman reached Wall Street and EXMP shares...',
'en',
array('article_date'=>strtotime('Today'))
);
$f->add_item(
'New Chairman of ExampleCorp Elected',
'http://example.com/news/2007/chairman',
'Joe Bloggs has been elected president of ExampleCorp...',
'en',
array('article_date'=>strtotime('Yesterday'))
);

// Now we just need to output the feed.

header("Content-Type: application/rss+xml");
print $f->output();

?>

The library also allows you to produce Atom, iCalendar, RDF and various
other feed formats for very little extra effort.

--
Toby A Inkster BSc (Hons) ARCS
http://tobyinkster.co.uk/
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!
Apr 30 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.