Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

php sorting xml by price or year



9:30 pm on Oct 24, 2013 (gmt 0)

This is my xml file:
<dealer id="3691">
<name>Bob's Truck</name>
<listing id="197083">
<type>Hay/Forage Equip</type>
<subtype>Round Baler</subtype>
<make>New Holland</make>
<attribute id="119" type="Option" name="Listing Type">Used</attribute>
<attribute id="36" type="Integer" name="Year">2007</attribute>
<attribute id="35" type="Price" name="Price" currency="NZD" gst="15" gst_value="ex-GST">18900</attribute>
<attribute id="19" type="Paragraph" name="Description">New Holland BR750 done 35000 bales, tidy baler, crop cutter, hyd reverser, brakes, runs very well.</attribute>
<listing id="298499">
<model>B/D Combination</model>
<attribute name="Item Condition" id="236" type="Option">New</attribute>
<attribute name="Year" id="36" type="Integer">2007</attribute>
<attribute name="Description" id="19" type="Paragraph">This trailer is
brand new.
It is floor stock at our dealership.
Price is negotiatble.</attribute>
<attribute name="Susp Options" id="63" type="Option">Air Bag</attribute>
<attribute name="Hubmeter" id="243" type="Integer" uom="KM">231</attribute>
<attribute name="Price" id="35" type="Price" currency="AUD" gst="10" gst_value="ex-GST" price_type="Drive Away no more to Pay">202141.82</attribute>

How can I sort the 2 listings by Year or Price in php? Cheers.


11:37 am on Oct 27, 2013 (gmt 0)

WebmasterWorld Senior Member penders is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

What method are you using to read your XML?
Are you actually wanting to rewrite your XML in the sorted order?
Or is this only for display?
What have you tried so far?

Featured Threads

Hot Threads This Week

Hot Threads This Month