discuz rss全文输出

网上很多内容都是针对论坛forum板块的,但是今天我需要的是portal的,所以在进行了一番研究后,在此把discuz两种rss的输出修改都写出来

Discuz!门户和论坛rss地址和相关文件。

门户地址:你的网址/portal.php?mod=rss

论坛地址:你的网址/forum.php?mod=rss

对应的控制rss输出内容的文件为:/source/module/portal/portal_rss.php和/source/module/forum/forum_rss.php。

贴上修改后的代码

这里是forum的
if($attachfile) {
    if($attachremote) {
        $filename = $_G['setting']['ftp']['attachurl'].'forum/'.$attachfile;
    } else {
        $filename = (!strstr($_G['setting']['attachurl'], '://') ? $_G['siteurl'] : '').$_G['setting']['attachurl'].'forum/'.$attachfile;
    }
}
//在这里加入数据库查询语句
$fdata = DB::fetch_first("SELECT * FROM ".DB::table('forum_post')." WHERE tid = '".$thread['tid']."' and first = 1");

echo    "    <item>\n".
    "      <title>".$thread['subject']."</title>\n".
    "      <link>$_G[siteurl]".($trewriteflag ? rewriteoutput('forum_viewthread', 1, '', $thread['tid']) : "forum.php?mod=viewthread&amp;tid=$thread[tid]")."</link>\n".
    // 这里是原代码 下面一行是查询到的内容 "      <description><![CDATA[".dhtmlspecialchars($thread['description'])."]]></description>\n".
    "      <description><![CDATA[".dhtmlspecialchars($fdata['message'])."]]></description>\n".
    "      <category>".dhtmlspecialchars($thread['forum'])."</category>\n".
    "      <author>".dhtmlspecialchars($thread['author'])."</author>\n".
    ($attachfile ? '<enclosure url="'.$filename.'" length="'.$attachsize.'" type="image/jpeg" />' : '').
    "      <pubDate>".gmdate('r', $thread['dateline'])."</pubDate>\n".
    "    </item>\n";
这里是portal的
if($attachfile) {
    if($attachremote) {
        $filename = $_G['setting']['ftp']['attachurl'].'portal/'.$attachfile;
    } else {
        $filename = $_G['siteurl'].$_G['setting']['attachurl'].'portal/'.$attachfile;
    }
}
//同理 这里是查询文章内容的数据查询
$fdata = DB::fetch_first("SELECT * FROM ".DB::table('portal_article_content')." WHERE aid = ".$article['aid']);


echo    "    <item>\n".
    "      <title>".$article['subject']."</title>\n".
    "      <link>$_G[siteurl]".($rewriteflag ? rewriteoutput('portal_article', 1, '', $article[aid]) : "portal.php?mod=view&amp;aid=$article[aid]")."</link>\n".
    //这里也是原代码片段 下面一行是查询到的数据 "      <description><![CDATA[".dhtmlspecialchars($article['description'])."]]></description>\n".
    "      <description><![CDATA[".dhtmlspecialchars($fdata['content'])."]]></description>\n".
    "      <category>".dhtmlspecialchars($article['catname'])."</category>\n".
    "      <author>".dhtmlspecialchars($article['author'])."</author>\n".
    ($attachfile ? '<enclosure url="'.$filename.'" length="'.$attachsize.'" type="image/jpeg" />'."\n" : '').
    "      <pubDate>".gmdate('r', $article['dateline'])."</pubDate>\n".
    "    </item>\n";

之所以需要修改 是因为rss默认查询的是 rss缓存表 这里只存储了摘要而没有内容 然后根据aid 或者 tid 去查询相应的内容
如有问题 欢迎通过快问咨询

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值