我需要在RSS中提供缩略图,例如在RSS中显示图片。我开始使用Yahoo的媒体RSS模块。好的文档,很好的例子。行。

这是我的RSS的XML和__片段,它不会显示图片:

<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/">
    <channel>
        <link>http://localhost:8080/dir/jrOreAeH/Pictures.html</link>
        <item>
            <title>Winter.jpg</title>
            <link>http://localhost:8080/photo/iZ0Omnkt/Winter.html</link>
            <media:content fileSize="105542" height="100"
                url="http://localhost:8080/img/37/f5b44ca3/Winter.jpg?sizeM=2" width="100"/>
            <pubDate>25/10/2010</pubDate>
        </item>
        <item>
            <title>Edge.jpg</title>
            <link>http://localhost:8080/photo/yfLmrjtu/Edge.html</link>
            <media:content fileSize="28521" height="100"
                url="http://localhost:8080/img/38/650b5132/Edge.jpg?sizeM=2" width="100"/>
            <pubDate>25/10/2010</pubDate>
        </item>
    </channel>
</rss>

我相信XML是正确的,应该显示图像,但实际上 - 不是。那么,怎么了?

没有正确的解决方案

其他提示

我使用的是正常工作:

<media:thumbnail url="http://localhost:8080/img/38/650b5132/Edge.jpg?sizeM=2" />
<media:content url="http://localhost:8080/img/38/650b5132/Edge.jpg?sizeM=2" />

尝试将元素嵌套在..内部。

然后,如果您在浏览器中查看RSS,默认情况下媒体元素有时不会显示,请查看源以查看您的媒体元素是否存在。

您可能必须使用PHP或ASP脚本将RSS转换为Xmldocumnet对象,然后在PHP中您可以回荡您的HTML并馈送变量。.对于ASP,我必须在A XSL样式表中致电以显示您想要的元素。 。

ASP脚本将RSS变成DOM DOC。

XSL样式表示例..

    <xsl:variable name="title" select="title" />
    <xsl:variable name="description" select="description" />
    <xsl:variable name="thumb" select="media:content/media:thumbnail/@url" />

    <p class="bold"><a style="text-decoration: none"><xsl:attribute name="href"><xsl:value-of select="link"/></xsl:attribute><xsl:value-of select="$title" disable-output-escaping="yes"/></a></p>
    <p><xsl:value-of select="$description" disable-output-escaping="yes"/></p>
    <img src="{$thumb}" alt="{$title}"/>
</xsl:if>

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top