Reply to Re: help on integrating RSS in site done in php

Your name:

Reply:


Posted by Toby A Inkster on 04/30/07 10:00

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/demiblog/trunk/blog/includes/Feed.class?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!

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация