开发者

What do I need to have feed for my CMS?

I have my own CMS(PHP/MySQL) and I want to add 3 or 4 different feeds.

I am not really sure what(kinds of codes) I need to add to my CMS.

Could anyone guide me the right direction please?

Thanks in advance.

--Edit--

Is there any application which convert my website to xml?

--Edit-- Is there any codes wh开发者_开发知识库ich I can use ? Any resources?


Rss is just some simple xml output I found a rss class for you, which would generate an whel formed rss for your cms. php script to create RSS-feed

You would use it like this:

$myfeed = new RSSFeed();
$myfeed->SetChannel('http://www.mysite.com/xml.rss',
          'My feed name',
                  'My feed description',
          'en-us',
          'My copyright text',
                  'me',
          'my subject');
$myfeed->SetImage('http://www.mysite.com/mylogo.jpg');
$myfeed->SetItem('http://www.mysite.com/article.php?id=bla',
                   'name',
                   'description');
....
echo $myfeed->output();


RSS is just an XML file with one "item" for each feed post. Read the specification and check out the example files here:

http://validator.w3.org/feed/docs/rss2.html

It's really simple. You don't need most of the tags for each item either, just title, link, description and pubDate.

description is probably the most "advanced" field as there is the place to put your text. The description field can contain HTML but you need to run it through htmlspecialchars first, like so:

echo '<description>' . htmlspecialchars($description) . '</description>';

I think you are able to figure the rest out on your own ;-)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜