I have a menu system that uses a drag and drop tree structure to make it easy for a user to modify. When the javascript serializes the string, it does it in the following way:
// Assume each of these items has an ID on with the respective numbers attached
Menu Item 1
+ Menu Item 2
+ Menu Item 3
+ Menu Item 4
Menu Item 5
Menu Item 6
+ Menu Item 7
This will then get serialized as:
1>2>3>>4#5#6>7
The problem with this is that there could be an arbitrary number of sublevels, which makes it difficult to unserialize. I'm using PHP server side to unserialize it but I am at a loss as to what to do.
Any suggestions welcome, even to the method of serialization, I’ll just hack the code.
You should look into json_encode/json_decode functions in PHP, those make interacting with Javascript really easy.
With your current serialization format you are just creating headaches for yourself.
I think you can split this string first by '#', then each split result splits by regex to exactly "number>number" so ">>" will not be there, then "number>>number" and so on.
Hope it helps.
Sorry for my english.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With