dt102282 2010-04-14 20:30
浏览 45

如何使用PHP Universal FeedParser添加我想要的链接

I have been trying to use the PHP Universal FeedParser to read RSS feeds and display the output on my site. Problem is I am VERY green with this and although it seems very simple. the only link that is working is the link provided in the sample. When I try to add another address with the xml or rss.php extensions, I keep getting errors,the page is loading blank,or the designated area for the feeds is blank. In addition to this, how can I add multiple links to feeds in a syntactically correct manor and how can I limit the amount of feeds? Thank you

Here it is:

<?php
    require_once($_SERVER['DOCUMENT_ROOT'] . '/includes/system/FeedParser.php');
    $Parser = new FeedParser();
    $Parser->parse("http://www.sitepoint.com/rss.php");
    $channels   = $Parser->getChannels();
    $items      = $Parser->getItems();
?>

and then:

<div id="rss_feeder">
                            <h1 id="title"><a href="<?php echo $channels['LINK']; ?>"><?php echo $channels['TITLE']; ?></a></h1>
                        <p id="description"><?php echo $channels['DESCRIPTION']; ?> </p>
                        <?php foreach($items as $item): ?>
                            <a class="feed-title" href="<?php echo $item['LINK']; ?>"><?php echo $item['TITLE']; ?></a>
                            <p class="feed-description"><?php echo $item['DESCRIPTION']; ?></p>
                        <?php endforeach;?>
                    </div>
  • 写回答

1条回答 默认 最新

  • dongzai0020 2010-04-15 09:01
    关注

    You may need to add the header tag around each link

    评论

报告相同问题?

悬赏问题

  • ¥15 无法输出helloworld
  • ¥15 高通uboot 打印ubi init err 22
  • ¥20 PDF元数据中的XMP媒体管理属性
  • ¥15 R语言中lasso回归报错
  • ¥15 网站突然不能访问了,上午还好好的
  • ¥15 有没有dl可以帮弄”我去图书馆”秒选道具和积分
  • ¥15 semrush,SEO,内嵌网站,api
  • ¥15 Stata:为什么reghdfe后的因变量没有被发现识别啊
  • ¥15 振荡电路,ADS仿真
  • ¥15 关于#c语言#的问题,请各位专家解答!