简体   繁体   English

构建带有链接的RSS feed

[英]Building a RSS feed with links embedded

Edit: I have this line: 编辑:我有这条线:

$comments = "http://www.kiubbo.com/index.php?action=comments&param=".$articles[$index]->getId();

And if I put it here it works out in the title tag, but not on the link or guid tags. 如果我将其放在此处,则可以在标题标签中找到,但不能在链接或guid标签上找到。

fwrite ($fp, "<item>\n");
fwrite ($fp, " <title>$title</title>\n");
fwrite ($fp, " <link>$comments</link>\n");
fwrite ($fp, "<guid>$comments</guid>\n");
fwrite ($fp, "</item>\n");
}
fwrite ($fp, "</channel></rss>\n");
fclose ($fp);

For some reason it takes out the "&param" part of the link ($comments). 由于某种原因,它会删除链接的“&param”部分($ comments)。

Thanks everybody. 谢谢大家。

If I;ve understood you correctly and your want the link to comments: 如果我已正确理解您的要求,并且希望链接到评论:

$comments = "YOUR_WEBSITE_HERE/index.php?action=comments&param=".$articles[$index]->getId();

you should probably also use <link rel="replies" for the link, every one loves semantics! 您可能还应该对<link rel="replies"使用<link rel="replies" ,每个人都喜欢语义!

Hope that helps, 希望能有所帮助,

Phil 菲尔

Could be your parser failing to error correct properly. 可能是您的解析器无法正确更正错误。 You haven't, for instance, escaped your ampersands. 例如,您没有逃脱&符。 Ask Feed Validator what is wrong. 询问Feed Validator有什么问题。

If you want to write an XML file, use an XML tool, don't munge together strings. 如果要编写XML文件,请使用XML工具,不要将字符串混在一起。

Ok, what I had wrong is I had to change & to &amp; 好吧,我有什么错的是我不得不改变&&amp; .

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM