Web Design Forum  
 
Go Back   Web Design Forum > Web Software > Scripts

Like Tree1Likes
  • 1 Post By conor

Reply
 
LinkBack Thread Tools Display Modes
Old 01-09-2012, 11:18 AM   #1
New Member
 
Join Date: Jan 2012
Posts: 3
Question Display RSS feed on website

Hi!

I need help displaying an RSS feed on my website which updates over time, but I only want to include those items which are in a certain category. Is there any way of doing this?
Any help would be appreciated!
jojoman2 is offline   Reply With Quote


Old 01-09-2012, 11:51 AM   #2
Gold Member
 
conor's Avatar
 
Join Date: Oct 2008
Location: Ireland
Posts: 349
Default

It depends on a few things. How is the rss generated? if it's a wordpress blog then I'm pretty sure you can filter by category very easily in the url. If not, you could write a PHP program which fetches the rss feed and then filters the results. Which of these cases are you looking for?
__________________
Conor
conor is offline   Reply With Quote
Old 01-09-2012, 12:37 PM   #3
New Member
 
Join Date: Jan 2012
Posts: 3
Default

The RSS is from a blog but I don't think it's made in wordpress. Here is the url: http://www.blogg.circusoflamia.com and the RSS: http://circusoflamia.blogg.se/index.rss

I havn't found a way to filter with the url anyway...
jojoman2 is offline   Reply With Quote
Old 01-09-2012, 04:14 PM   #4
Gold Member
 
conor's Avatar
 
Join Date: Oct 2008
Location: Ireland
Posts: 349
Default

Yeah don't think it will be possible to filter by URL with that blog.

Here's a quick PHP program which will fetch the rss feed, filter it by the $category variable and print the results:

Code:
$category = 'Insanity';

$dom = new DOMdocument( );

$success = $dom->load( 'http://circusoflamia.blogg.se/index.rss' );
if( !$success )
        die( 'failed to load url' );

$elements = $dom->getElementsByTagName( 'item' );
$items = array( );

foreach( $elements as $element ){
        $item = array( );

        if( $element->getElementsByTagName( 'category' )->item( 0 ) == $category ){
                foreach( $element->childNodes as $node )
                                $item[ $node->nodeName ] = $node->nodeValue;
             
                array_push( $items, $item );
        }
}

die( print_r( $items ) );
That's just off the top of my head but it should give you an idea on how to do this yourself
jojoman2 likes this.
__________________
Conor
conor is offline   Reply With Quote
Old 01-09-2012, 07:57 PM   #5
New Member
 
Join Date: Jan 2012
Posts: 3
Default

Thanks a lot for the help!
jojoman2 is offline   Reply With Quote


Reply

Tags
category, display, rss

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 11:20 AM.


Camera Forum - Computer Forum - Web Design Forum

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO 3.6.0 ©2011, Crawlability, Inc.