/** * 页面feed * @param null * 显示数量由 feed_num决定 */ public function listsPage() { $PostsList = new PostsLogic(); $post_list = $PostsList->getList(get_opinion('feed_num'), 'page', 'post_id desc', true); $RSS = new RSS(get_opinion('title'), '', get_opinion('description'), ''); // 站点标题的链接 foreach ($post_list as $list) { $RSS->AddItem($list['post_title'], 'http://' . $_SERVER["SERVER_NAME"] . getPageURLByID($list['post_id']), $list['post_content'], $list['post_date']); } $RSS->Display(); }
function rss() { import('ORG.Util.Rss'); $myRss = new RSS("大米CMS", C('SERVER_URL'), "大米CMS"); $list = M('article')->where('1=1')->select(); foreach ($list as $k => $v) { $myRss->AddItem($v['title'], 'http://' . $_SERVER['SERVER_NAME'] . url('articles', $v['aid']), $v['addtime']); } $myRss->BuildRSS(); $myRss->SaveToFile('./feed.rss'); $myRss->getFile('./feed.rss'); }