【问题标题】:RSS feed displayRSS提要显示
【发布时间】:2011-07-23 14:27:41
【问题描述】:

我为我的网站创建了一个新闻 RSS 提要,但希望显示的格式类似于 http://www.apple.com/hotnews/ 我如何将代码放到我的 HTML 页面上,以便从我的 RSS 中获取项目?

【问题讨论】:

    标签: php html rss feed


    【解决方案1】:

    您可以使用 XSLT 和 CSS。

    如果您不关心链接是否正常工作等,那么只需使用 CSS。

    例如,以下是我在我的一个网站上设置其中一个 RSS 提要的样式:

    channel link, channel language, channel copyright, channel managingEditor, channel webMaster, channel docs, channel lastBuildDate, channel item pubDate {display:none;}
    
    rss {font-family:Arial, Helvetica, sans-serif;}
    
    channel title {display:block; padding:1em; color:#FFF; border-bottom:1px solid black; font-weight:bold;font-size:140%; background-color:#4483C7;}
    
    channel description {display:block; float:left; font-size:130%; margin:1em;}
    
    channel item {border:1px solid #4483c7;clear:both; display:block; padding:0.5em; margin:1em;}
    
    channel item title {background-color:#4483c7; border-bottom-width:0; color:#FFF; display:block; font-size:110%; font-weight:bold; margin:0; padding:0.2em;}
    
    channel item description {display: block; float:none; margin:0; text-align: left; padding:0.2em 0.5em 0.4em; color: black; font-size:100%; font-weight:normal;}
    
    channel item link {color:#666; display:block; font-size:86%; padding:0 0.5em;}
    

    结果是这样的:http://www.ourladyofgrace.com/Bulletins/olg_bulletins.xml

    如果您想让页面“正常工作”,请使用 XSLT。

    这里有一些信息。 http://www.paulwest.co.uk/article.php/styling-rss-news-feeds-with-xslt

    【讨论】:

      【解决方案2】:

      由于 HTML 仅用于布局,因此它与显示 RSS 提要无关。除非你想要和苹果一样的布局(我认为你不想要。)

      为此,您需要 PHP、javascript 甚至是 flash。

      1. PHP solution
      2. JavaScript solution
      3. Flash solution

      选择你的毒药!

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-04-26
        • 1970-01-01
        • 1970-01-01
        • 2020-06-06
        • 2012-07-19
        相关资源
        最近更新 更多