0

Can someone please help me out. I'm looking for a way to force chrome to display my rss feed in a more user friendly way. I know chrome doesnt support this by default but I've seen websites like BBC (http://feeds.bbci.co.uk/shared/bsp/xsl/rss/nolsol.xsl) doing it.

I'm using drupal 7 views to generate the rss feed so anything I do will need to be done by modifying the views-view-rss.tpl.php file which looks as follows:

<?php print "<?xml"; ?> version="1.0" encoding="utf-8" <?php print "?>"; ?>
<rss version="2.0" xml:base="<?php print $link; ?>"<?php print $namespaces; ?>>
<channel>
<title><?php print $title; ?></title>
<link><?php print $link; ?></link>
<description><?php print $description; ?></description>
<language><?php print $langcode; ?></language>
<?php print $channel_elements; ?>
<?php print $items; ?>
</channel>
</rss>
4

2 回答 2

0

您可能想要使用 XSL,这需要对该视图模板进行微小的更改......以及大量的 XSL。

<?php print "<?xml"; ?> version="1.0" encoding="utf-8" <?php print "?>"; ?>
<?xml-stylesheet href="/css/rss20.xsl" type="text/xsl"?>
<rss version="2.0" xml:base="<?php print $link; ?>"<?php print $namespaces; ?>>

我发现 XSL 令人讨厌,但您可能只是基于您在网络上找到的东西。您的 BBC 链接是一个好的开始,或者《纽约时报》也有一个很好的链接:查看源:http://feeds.nytimes.com/css/rss20.xsl

于 2012-04-14T07:33:11.567 回答
0

您始终可以使用view-source:前缀,它将适用于每个提要。

例如,如果您的提要有 url http://feeds.guardian.co.uk/theguardian/rss,您可以view-source:http://feeds.guardian.co.uk/theguardian/rss在 Chrome 的地址栏中输入,它会向您显示其完整的 XML。

此外,当查看格式化的提要时(点击页面上的 RSS 图标/链接后),右上角有一个“提要”链接(在“提要预览”蓝色条上),它会将您带到完全相同的view-source:页面.

于 2012-04-13T13:16:00.540 回答