How do you generate an RSS feed?

后端 未结 8 2177
野的像风
野的像风 2021-02-04 17:59

I\'ve never done it myself, and I\'ve never subscribed to a feed, but it seems that I\'m going to have to create one, so I\'m wondering. The only way that seems apparent to me i

8条回答
  •  旧巷少年郎
    2021-02-04 18:41

    For PHP I use feedcreator http://feedcreator.org/

    useCached();
    $rss->title = "Item List";
    $rss->cssStyleSheet='';
    $rss->description = 'this feed';
    $rss->link = CONFIG_SYSTEM_URL;
    $rss->syndicationURL = CONFIG_SYSTEM_URL.'feed.php';
    
    
    $articles=new itemList();  // list of stuff
    foreach ($articles as $i) {   
        $item = new FeedItem();
        $item->title = sprintf('%s',$i->title);
        $item->link = CONFIG_SYSTEM_URL.'item.php?id='.$i->dbId;
        $item->description = $i->Subject;   
        $item->date = $i->ModifyDate;   
        $item->source = CONFIG_SYSTEM_URL;   
        $item->author = $i->User;
        $rss->addItem($item);
    }
    
    print $rss->createFeed($feedformat);
    

提交回复
热议问题