Member Avatar
<ol class="dd-list" id="start">
        <li class="dd-item dd3-item">
            <div class="dd-handle dd3-handle"></div>
            <div class="dd3-content">Home</div>
            <div class="url" style="display:none;">homeurl</div>
        </li>
        <li class="dd-item dd3-item">
            <div class="dd-handle dd3-handle"></div>
            <div class="dd3-content">About Us</div>
            <div class="url" style="display:none;">abouturl</div>
        </li>
        <li class="dd-item dd3-item">
            <div class="dd-handle dd3-handle"></div>
            <div class="dd3-content">Gallery</div>
            <div class="url" style="display:none;">galleryurl</div>
            <ol class="dd-list">
                <li class="dd-item dd3-item">
                    <div class="dd-handle dd3-handle"></div>
                    <div class="dd3-content">Contact</div>
                    <div class="url" style="display:none;">contacturl</div>
                </li>
            </ol>
        </li>
    </ol>

Hi I want to loop through this ordered list and save the values in a multi-dimensional array.

I tried to do this in PHP but it was too difficult. Thanks.

Recommended Answers

All 8 Replies

Member Avatar

Thanks prit but that didn't really help. Any ideas, or is it better to do this in PHP server side.

Member Avatar

Uno momento por favor...

Member Avatar

I would like it to look like:

{
    "content": [
        {
            "content": [
                {
                    "css": "dd-handle dd3-handle"
                }, 
                {
                    "content": {
                        "text": "Home"
                    }, 
                    "css": "dd3-content"
                }, 
                {
                    "attrs": {
                        "style": "display:none;"
                    }, 
                    "content": {
                        "text": "homeurl"
                    }, 
                    "css": "url"
                }
            ], 
            "css": "dd-item dd3-item", 
            "type": "li"
        }, 
        {
            "content": [
                {
                    "css": "dd-handle dd3-handle"
                }, 
                {
                    "content": {
                        "text": "About Us"
                    }, 
                    "css": "dd3-content"
                }, 
                {
                    "attrs": {
                        "style": "display:none;"
                    }, 
                    "content": {
                        "text": "abouturl"
                    }, 
                    "css": "url"
                }
            ], 
            "css": "dd-item dd3-item", 
            "type": "li"
        }, 
        {
            "content": [
                {
                    "css": "dd-handle dd3-handle"
                }, 
                {
                    "content": {
                        "text": "Gallery"
                    }, 
                    "css": "dd3-content"
                }, 
                {
                    "attrs": {
                        "style": "display:none;"
                    }, 
                    "content": {
                        "text": "galleryurl"
                    }, 
                    "css": "url"
                }, 
                {
                    "content": {
                        "content": [
                            {
                                "css": "dd-handle dd3-handle"
                            }, 
                            {
                                "content": {
                                    "text": "Contact"
                                }, 
                                "css": "dd3-content"
                            }, 
                            {
                                "attrs": {
                                    "style": "display:none;"
                                }, 
                                "content": {
                                    "text": "contacturl"
                                }, 
                                "css": "url"
                            }
                        ], 
                        "css": "dd-item dd3-item", 
                        "type": "li"
                    }, 
                    "css": "dd-list", 
                    "type": "ol"
                }
            ], 
            "css": "dd-item dd3-item", 
            "type": "li"
        }
    ], 
    "css": "dd-list", 
    "id": "start", 
    "type": "ol"
}

That's almost the entire HTML... why don't you send that instead? What is the goal on the PHP side?

Member Avatar

I am building my own menu manager for a CMS.

http://www.daniweb.com/web-development/php/threads/479665/store-unordered-list/

The HTML above is the one that has the drag and drop functionality, essentially all I need is the li structure, the name and the url.

Once I have that I can build the actual menu which will have a different css style. It will need to be saved to the database.

Member Avatar

I've decided to do this with PHP

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.