views:

23

answers:

0

How can I use something like jQuery & PHP to reorder elements within an xml file?

The jQuery plugins below allow html table rows or list items to be swapped about, but I have no idea of how to save those changes back to an XML file with the click of a button.

www.isocra.com/2008/02/table-drag-and-drop-jquery-plugin/

www.jqueryui.com/demos/sortable/

Here it describes a function to Rearrange/Reorder Elements: http://quest4knowledge.wordpress.com/2010/09/04/php-xml-create-add-edit-modify-using-dom-simplexml-xpath/

But that only shows how to swap the position of two elements, not multiple ones. Can they be combined to reorder a longer list of elements?

I'm trying to avoid using mySQL, just php/jquery/xml...

<?xml version="1.0" encoding="utf-8"?>
<gallery>
  <picture id="0001">
    <title>Title One</title>
    <description>Some text here</description>
  </picture>
  <picture id="0002">
    <title>Title Two</title>
    <description>Some more text here</description>
  </picture>
  <picture id="0003">
    <title>Title Three</title>
    <description>Some other text here</description>
  </picture>
</gallery>

Thanks Andy.