Shubham Kanodia
Shubham Kanodia

Reputation: 6236

How can I embed and customize an RSS feed on my website?

So basically, I want to display a few blog posts from particular websites on my website (with due credit of course). I tired searching on Google, and I came across a few sites (like http://feed.mikle.com/) that make this possible, but they are useless to me because they don't allow me to customize the CSS and styling!

I want to fetch raw text and apply custom design to it, so it doesn't look out of place on my website. What is the best option for doing so? How should I proceed?

Upvotes: 0

Views: 1078

Answers (1)

Matthias Seifert
Matthias Seifert

Reputation: 2073

Thats how i parse feeds on my page:

<?php
    function ParseFeed () {
        $xmlfile='http://feedli.nk';
        $xml = simplexml_load_file(rawurlencode($xmlfile));
        $namespaces = $xml->getNamespaces(true);

        foreach ($xml->channel->item as $item) {
            echo '<div class="imageWrapper">';
                echo '<img src="' . $item->children($namespaces['media'])->content->attributes()->url . '" alt="FlickrImage" class="FlickrImage">';
                echo '<div class="ImageInfo"><p class="ImageInfoText"><nobr>';
                    echo $item->title . '</nobr><br>';
                    echo '<a target="_blank" href="' . $item->author->attributes($namespaces['flickr'])->profile . '">' . $item->children($namespaces['media'])->credit . '</a>';
                echo '</p></div>';
            echo '</div>';
        }
    }
?>

Upvotes: 1

Related Questions