homepage Welcome to WebmasterWorld Guest from 54.145.172.149
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
php sorting xml by price or year
alexchen2013



 
Msg#: 4618887 posted 9:30 pm on Oct 24, 2013 (gmt 0)

This is my xml file:
<dealer id="3691">
<name>Bob's Truck</name>
<remote_customer_id>ABC123</remote_customer_id>
<listing id="197083">
<stock_number>18005</stock_number>
<industry>Agriculture</industry>
<type>Hay/Forage Equip</type>
<subtype>Round Baler</subtype>
<make>New Holland</make>
<model>BR750</model>
<attributes>
<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>
</attributes>
</listing>
<listing id="298499">
<stock_number>XT4924</stock_number>
<industry>Transport</industry>
<type>Trailer</type>
<subtype>Tipper-trailer</subtype>
<make>Lusty</make>
<model>B/D Combination</model>
<attributes>
<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>
</attributes>
</listing>
</dealer>


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

 

penders

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



 
Msg#: 4618887 posted 11:37 am on Oct 27, 2013 (gmt 0)

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?

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved