We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum


Thread tagged as: Question

Setting up an RSS Feed


I need some help setting up an RSS feed to my site. My client uses a shelter manager and wants to integrate their rss onto the site (http://public.sheltermanager.com/animals/gw1124/rss.xml). So I've followed the docs and I'm just a bit confused at where I reference where the feed is coming from?

So I've set up the rss.php page

   <?php include('admin/runtime.php'); ?>
    <?php echo '<'.'?xml version="1.0"?'.'>'; ?>
    <rss version="2.0">
        <title>Available for Adoption</title>
        <description>Animals Available for Adoption at Llys Nini</description>
            $opts = array(
            perch_content_custom('Available for Adoption', $opts);

And I've also added this to the available-for-adoption.php page

<link rel="alternate" type="application/rss+xml" title="RSS" href="rss.php" />

Can someone point me in the right direction to tell me what to do?

Thank you!

Jade Marling

Jade Marling 0 points

  • 2 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

I'm just a bit confused at where I reference where the feed is coming from

What do you mean by this?

The RSS is on a thrid party site, so where do I state where the RSS is coming from?

Rachel Andrew

Rachel Andrew 394 points
Perch Support

The docs are for creating an RSS feed from your content, not consuming a third party one.

So I can't do it?

Simon Clay

Simon Clay 127 points

Hi Jade, it is possible to do this, but it's not Perch related. I will dig out my notes and let you know how I did it on another project.

If you could that would be appreciated. Thanks Simon!

Simon Clay

Simon Clay 127 points

Hi Jade, could you just clarify what result you are after?

Are you trying to show an external feed (http://public.sheltermanager.com/animals/gw1124/rss.xml) as a listing on a page on your website?

That's right yes. It will basically be split up into dogs, cats and small animals. Each category will then show a gallery of the animals clicking off onto a details page for them

Hi Simon, did you get chance to find the code for me?


Simon Clay

Simon Clay 127 points

Hi Jade,

This code will pull the info from the feed and display it onto your page:


    $xml_feed = new DOMDocument();
    $feed_items = array();
    foreach ($xml_feed->getElementsByTagName('item') as $node) {
        $item = array ( 
            'title' => $node->getElementsByTagName('title')->item(0)->nodeValue,
            'desc' => $node->getElementsByTagName('description')->item(0)->nodeValue,
            'link' => $node->getElementsByTagName('link')->item(0)->nodeValue,
        array_push($feed_items, $item);

    foreach ($feed_items as $feed_item) { ?>
            <a href="<?php echo $feed_item["link"] ?>">
                <h4><?php echo $feed_item["title"] ?></h4>
            <p><?php echo $feed_item["desc"] ?></p>

<?php } ?>