开发者

How can I add my desired links to be read using 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      = $Parse开发者_C百科r->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>


You may need to add the header tag around each link

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜