SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Nov 2002
    Location
    Maryland
    Posts
    307
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Creating/Editing hierarchal data

    I found many tutorials on how to store and display hierarchal data using PHP, but nothing on how to create and edit hierarchal data using form fields. I need to create this functionality for a CMS. This functionality will probably need to use AJAX or DHTML. Can anyone point me to a tutorial or give me tips on how it should be done?

    The functionality would look something like this:
    http://davidwees.com/sortable/

    ...but using data from the database being displayed in text fields.

    Any help is greatly appreciated.

  2. #2
    SitePoint Addict
    Join Date
    Nov 2002
    Location
    Maryland
    Posts
    307
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Anyone?

  3. #3
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So long as this is some kinda admin thing where you have little worry of being accessible to random users, I would definitely commit to using javascript for this. The user interface is so much nicer to use when you can drag and drop opposed to the non clientside scripting way; having to constantly reload the webpage to move a node up or down a slot by clicking arrow buttons and stuff.

    If the data set is not too large, you might find the job is simplified if you just send the entire structure to php on every update, and just kinda overwrite the entire structure serverside with the new one. It's definitely not the most efficient way to do it, but I'm guessing that isn't a big deal here.

    I would probably look into converting that dom structure into xml, and just sending that to the server via ajax. Then you have a nice robust structure which you can traverse using common php code/tools, and update the db. You don't really need to name the text fields or anything, since you'll be using the natural ordering of the dom structure.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •