Umwandeln PHP array in HTML-Liste

Habe ich das array unter dem ich möchte eine Ausgabe in einem bestimmten HTML-Liste format.

Meine PHP-array ist wie folgt:

Array
(
    [MAIN] => Master Product
    [ID1] => Array
        (
            [0] => Product 1
        )

    [ID2] => Array
        (
            [0] => Product 2
            [ID3] => Array
                (
                    [0] => Product 3
                )

            [ID4] => Array
                (
                    [0] => Product 4
                )
        )
)

Den HTML-Liste format, das ich Suche, ist wie folgt.

<ul id="treeview">
    <li>Master Product
        <ul>
            <li>Product 1</li>
            <li>Product 2
                <ul>
                    <li>Product 3</li>
                    <li>Product 4</li>
                </ul>
            </li>
        </ul>
    </li>
</ul>

Jede mögliche Hilfe würde geschätzt.

InformationsquelleAutor hawx | 2012-03-03
Schreibe einen Kommentar