duanpang5583 2012-04-27 07:43
浏览 33

无法获得RSS feed来处理joomla 1.5

I have a problem with RSS feeds in Joomla 1.5.

I use Joomla 1.5 and custom component. I tried to add rss feeds. I don't know what is the problem, but no data is displayed in firefox google reader. I tested with Chrome and it displays information, but only pure XML (not styled). And if I tried google reader with Chrome, then no information again.

Only thing that appears in google reader, is the site description. And instead of information, I only get "(title unknown)". This is the file that takes news and puts them into RSS feed. Maybe somebody can understand what is wrong with it :).

$xml = new XMLWriter();
$xml->openURI('php://output');
$xml->startDocument("1.0");
$xml->setIndent(true);

$xml->startElement('rss');
$xml->writeAttribute('version', '2.0');
$xml->writeAttribute('xmlns:g', 'http://base.google.com/ns/1.0');
$xml->startElement("channel");
$xml->writeElement("title", $mainframe->getCfg('sitename'));
$xml->writeElement("description", $mainframe->getCfg('MetaDesc'));
$xml->writeElement("link", JURI::root());

if($this->projects){
   // start listings
   foreach ($this->projects as $project){

      $xml->startElement("item");
        $xml->writeElement("g:title", $project[title] );
        $xml->writeElement("g:description", $project[description] );
        $xml->endElement();
   }
}

$xml->endElement(); // rss
$xml->endDocument();
$xml->flush();

This is corresponding xml

<rss xmlns:g="http://base.google.com/ns/1.0" version="2.0">
<channel>
<title>MyProject</title>
<description>
My project description
</description>
<link>http://mysite.com</link>
<item>
<g:title>Copywriter</g:title>
<g:description>...</g:description>
</item>
<item>...</item>
<g:title>Design Manager</g:title>
<g:description>...</g:description>
</item>
</channel>
</rss>

And this is what i get in google reader

  • 写回答

1条回答 默认 最新

  • dongwei3336 2012-04-27 07:50
    关注

    You might want to post your output, but at least you are missing one endElement: You need one for the rss, and oone for the channel, don't you?

    评论

报告相同问题?

悬赏问题

  • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号