NYCPHP Meetup

NYPHP.org

[nycphp-talk] PHP4 Array/XML sorting question

Tim Boyden TBoyden at SUPERCOUPS.com
Tue Apr 11 13:28:41 EDT 2006


Hello,
 
I am working on a web page that lists some ads stored in an XML file and I'm
having trouble with figuring out how to sort the listings by their
"category" element. Currently I pull the "ad" elements from the XML into an
array and print out the HTML list of ads in a non-sorted manner. I'd like it
to print out with a header for the category followed by a list of ads in
that category. I'm not sure how to code it though. Any help would be
appreciated. Below is a snippet from the XML file:
 
<?xml version="1.0" encoding="iso-8859-1"?>
<ads>
<ad>
    <franchise>test</franchise>
    <category>Food</category>
    <title>Test 1</title>
    <url>testpage1.pdf</url>
</ad>
<ad>
    <franchise>test</franchise>
    <category>Home Improvement</category>
    <title>Test 2</title>
    <url>testpage2.pdf</url>
</ad>
<ad>
    <franchise>test</franchise>
    <category>Services</category>
    <title>Test 3</title>
    <url>testpage3.pdf</url>
</ad>
</ads>

Thanks,
 
Tim Boyden
 
--------------------------- 
Timothy Boyden 
Network Administrator 
tboyden at supercoups.com 
  
SuperCoups(r) | 350 Revolutionary Drive | E. Taunton, MA 02718 
508-977-2034  | www.supercoups.com 
--------------------------- 
Local Coupons. Super Savings.(r)
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20060411/0e6bbe4e/attachment.html>


More information about the talk mailing list