I am trying to use SimpleXML to store some relatively simple info in an XML file...basically using the data file as my datasource instead of a database.
i have it basicvally working for all functions (adding, deleting and displaying)...but i am wonderign how i can control the order in which the items will be displayed.
my xml looks like this:
<?xml version="1.0" encoding="utf-8"?>
<linkCollection>
<linkGroup id="1" title="Photoshop">
<linkItem id="2">
<title>PSD Tuts</title>
<description>PSDTUTS is a blog/Photoshop site made to house and showcase some of the best Photoshop tutorials around. We publish tutorials that not only produce great graphics and effects, but explain in a friendly, approachable manner.</description>
<url>http://www.psdtuts.com</url>
</linkItem>
<linkItem id="4">
<title>Tutorial9 - Photoshop</title>
<description>We are Tutorial9 - a collection of teachers, experts, and caring folk from around the world, all gathered in one place to pass along our knowledge to absolutely anyone interested in learning.</description>
<url>http://www.tutorial9.net/category/photoshop/</url>
</linkItem>
</linkGroup>
<linkGroup id="2" title="Web Design">
<linkItem id="2">
<title>Tutorial9 - Web</title>
<description>We are Tutorial9 - a collection of teachers, experts, and caring folk from around the world, all gathered in one place to pass along our knowledge to absolutely anyone interested in learning.</description>
<url>http://www.tutorial9.net/category/web-tutorials/</url>
</linkItem>
<linkItem id="4">
<title>NETTUTS</title>
<description>NETTUTS is a site aimed at web developers and designers offering tutorials and articles on technologies, skills and techniques to improve how you design and build websites. We cover HTML, CSS, Javascript, CMS’s, PHP and Ruby on Rails.</description>
<url>http://nettuts.com</url>
</linkItem>
</linkGroup>
</linkCollection>
so if i were to use the id attribute of each LinkItem as the item to sort by, how could i use simpleXML to display the LinkItems in the correct order?
I know that using simpleXML i can basically loop through each LinkGroup and display the info from each linkItem in the order that they exist in the file but i don't know how to display then ordered by ID.
any help woudl be appreciated.