[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[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!

9.2

sort parts of XML

Asked by NeilT in Extensible Markup Language (XML), PHP Scripting Language, Web Languages/Standards

Hi

I'm using SimpleXML to grab the highways agency rss feed but would like to sort the results by the title before displaying them, can someone assist in modifying my code below please to do this.

Thanks
Neil
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:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
td { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px;	padding:5px; }
.title { border:1px solid #ffffff; background-color: #666666; color:#ffffff; }
.description { border:1px solid #999999; background-color:#ffffff; color: #666666; }
-->
</style>
</head>
<body>
<?php
/*
<channel>
<item>
  <title>A2 Kent | Westbound | Roadworks</title> 
  <description>On the A2 from Rochester to</description> 
  <author>ha_info@highways.gsi.gov.uk</author> 
  <pubDate>Wed, 19 Aug 2009 11:51:11 GMT</pubDate> 
  <link>http://www.trafficengland.co.uk/map.aspx?isTrafficAlert=true&lat=51.430374&lon=0.29712</link> 
  <guid isPermaLink="false">P-09-0803-0030</guid> 
  <category>roadworks</category> 
  <category>heavy disruption</category> 
  </item>
</channel>
*/
 
$xml_traffic = "http://www.highways.gov.uk/rssfeed/SouthEast.xml";
$xml = simplexml_load_file($xml_traffic);
$count = count($xml->channel->item);
 
if ($count < 1) {
	echo "<p>Error getting traffic feed</p>";
} else {
echo "<table>";
	for ($i = 0; $i < $count; $i++) {
		echo "<tr>";
		echo "<td class='title'>" . $xml->channel->item[$i]->title . "</td>";
		echo "<td class='description'>" . $xml->channel->item[$i]->description . "</td>";
		//echo "<td>" . $xml->channel->item[$i]->pubDate . "</td>";
		//echo "<td>" . $xml->channel->item[$i]->category[0] . "</td>";
		echo "</tr>";
	}	
	echo "<table>";
}
 
?>
</body>
</html>
[+][-]09/23/09 04:08 AM, ID: 25401719Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]09/23/09 04:40 AM, ID: 25401957Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/23/09 05:07 AM, ID: 25402134Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: Extensible Markup Language (XML), PHP Scripting Language, Web Languages/Standards
Sign Up Now!
Solution Provided By: Ray_Paseur
Participating Experts: 1
Solution Grade: A
 
[+][-]09/24/09 07:27 AM, ID: 25413673Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091021-EE-VQP-81 - Hierarchy / EE_QW_3_20080625