Advertisement

01.19.2008 at 08:38AM PST, ID: 23095747
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

SimplePie - Display only 1 Item from each of 4 Feeds

Tags: simplepie, item, display
I want to display the content (link, description, image) of 4 individual feeds on on static page with PHP and SimplePie 1.1. However, I don't want to display all of the items from each feed, just the one most recent item from each feed. Make sense?

http://www.simplepie.org/
Start your free trial to view this solution
Question Stats
Zone: Web Development
Question Asked By: emory7
Solution Provided By: hielo
Participating Experts: 1
Solution Grade: A
Views: 4
Translate:
Loading Advertisement...
01.19.2008 at 01:57PM PST, ID: 20699212

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.20.2008 at 12:23AM PST, ID: 20700497

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.20.2008 at 09:07AM PST, ID: 20701732

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.20.2008 at 08:25PM PST, ID: 20703881

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.21.2008 at 07:08PM PST, ID: 20711627

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.21.2008 at 10:13PM PST, ID: 20712257

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Handhelds / PDAs
  • Displays / Monitors
  • Components
  • Networking Hardware
  • Peripherals
  • Laptops/Notebooks
  • Storage
  • Servers
  • Desktops
  • New Users
  • Misc
  • Apple
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMWare
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMWare
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Community Advisor
  • Lounge
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • Community Advisor
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
01.19.2008 at 01:57PM PST, ID: 20699212

Rank: Genius

This accomplishes what you want. You will need to format the output to suit your needs.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
<?php
require_once("simplepie.inc");
 
//make a comma-separated list of all the feeds
$feedList = "http://simplepie.org/blog/feed/,http://www.msnbc.msn.com/id/3032091/device/rss/rss.xml,http://www.msnbc.msn.com/id/3032112/device/rss/rss.xml,http://www.msnbc.msn.com/id/3032117/device/rss/rss.xml";
 
//convert to array
$feedList = explode(",",$feedList);
 
//print desired data from each feed
for($i=0, $limit = count($feedList); $i < $limit; ++$i)
{
	//specify feed url and number of items
	printData($feedList[$i],1);
}
 
//fetches feed. If item count is not specified, it will print all the items
function printData($url, $itemCount=-1)
{
	// Single feed
	$feed = new SimplePie();
	$feed->set_feed_url($url);
	$feed->enable_cache(false); 
	$feed->enable_order_by_date(true);
	$feed->init();
	if($itemCount<0)
		$itemCount = $feed->get_item_quantity();
 
	echo "<hr />";
	echo "Image Url: ". $feed->get_image_url() . "<br/>";
	for($i=0; $i < $itemCount; ++$i)
	{
	echo "Link: ". $feed->get_item($i)->get_link() . "<br/>";
	echo "Description: ". $feed->get_item($i)->get_description() . "<br/>";
	}
}
?>
Open in New Window
 
01.20.2008 at 12:23AM PST, ID: 20700497
This seems to be on the right track but it's outputting this:

Image Url: http://msnbcmedia.msn.com/i/msnbc/SiteManagement/SiteWide/Images/msnbc_logo.gif
Link: http://www.msnbc.msn.com/id/22744963/
Description:
Maryland hands Tar Heels their first loss of season with 82-80 win.

When it needs to be this:

Title (hyperlink)
Description (pic if exists, text)
 
01.20.2008 at 09:07AM PST, ID: 20701732

Rank: Genius

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
<?php
require_once("simplepie.inc");
 
//make a comma-separated list of all the feeds
$feedList = "http://simplepie.org/blog/feed/,http://www.msnbc.msn.com/id/3032091/device/rss/rss.xml,http://www.msnbc.msn.com/id/3032112/device/rss/rss.xml,http://www.msnbc.msn.com/id/3032117/device/rss/rss.xml";
 
//convert to array
$feedList = explode(",",$feedList);
 
//print desired data from each feed
for($i=0, $limit = count($feedList); $i < $limit; ++$i)
{
	//specify feed url and number of items
	printData($feedList[$i],1);
}
 
//fetches feed. If item count is not specified, it will print all the items
function printData($url, $itemCount=-1)
{
	// Single feed
	$feed = new SimplePie();
	$feed->set_feed_url($url);
	$feed->enable_cache(false); 
	$feed->enable_order_by_date(true);
	$feed->init();
	if($itemCount<0)
		$itemCount = $feed->get_item_quantity();
 
	for($i=0; $i < $itemCount; ++$i)
	{
		echo "<p class='feedItem'><div class='feedTitle'><a href='".$feed->get_item($i)->get_link()."'>". $feed->get_item($i)->get_title() . "</a></div>";
		echo "<div class='feedDescription'>". $feed->get_item($i)->get_description() . "</div></p>";
	}
}
?>
Open in New Window
Accepted Solution
 
01.20.2008 at 08:25PM PST, ID: 20703881
This certainly displays the title and description as requested. If it is possible to adjust it to do the below, I will gladly double points. Thanks.

--display an image from a wordpress blog feed (I tested and could not get it to display any).
--make it display the name of each wordpress category
--allow different settings for each feed (so different feeds can appear separately on different areas of a page instead of grouped all together)
 
01.21.2008 at 07:08PM PST, ID: 20711627

Rank: Genius

The maximum assignable to any problem is 500. You would need to open a new problem. You would also need to "point" me to a wordpress blog feed, since I have never seen one.
 
01.21.2008 at 10:13PM PST, ID: 20712257
Thanks for your help. I may open up a new one then. Please feel free to jump in if you see it.
 
 
20080236-EE-VQP-29 / EE_QW_2_20070628