Traverse Array and Display in <li><div> markup
<p>I want to traverse this array and display, in bulleted divs. I know this look a lot suspicious, like do it yourself. But I cant get past the nested foreach problem, especially, when it comes to deph of the threads. I got an answer in a previous question <a href="http://stackoverflow.com/questions/7288081/traverse-array-and-display-in-bullet-points">Traverse Array and Display In Bullet Points</a>, but i'm not sure how to change the markup in the solution that was given.... or if its possible. Below is the array, and i have a link to the pastebin of the markup i would like, but would be awesome if the markup can be changed easily in the future, ie markup views separated from logic.</p>

<pre><code>Array
(
    [1] =&gt; Array
        (
            [id] =&gt; 1
            [comment_title] =&gt; comment title
            [comment] =&gt; a
            [comment_date] =&gt; comment date
            [parent_id] =&gt; 0
            [children] =&gt; Array
                (
                    [3] =&gt; Array
                        (
                            [id] =&gt; 3
                            [comment_title] =&gt; comment title
                            [comment] =&gt; this is another comment
                            [comment_date] =&gt; comment date
                            [parent_id] =&gt; 1
                            [depth] =&gt; 0
                            [child_count] =&gt; 0
                            [children] =&gt; 
                        )

                    [4] =&gt; Array
                        (
                            [id] =&gt; 4
                            [comment_title] =&gt; comment title
                            [comment] =&gt; this is a third comment
                            [comment_date] =&gt; comment date
                            [parent_id] =&gt; 1
                            [depth] =&gt; 0
                            [child_count] =&gt; 0
                            [children] =&gt; 
                        )

                )

            [depth] =&gt; 1
            [child_count] =&gt; 2
        )

    [2] =&gt; Array
        (
            [id] =&gt; 2
            [comment_title] =&gt; comment title
            [comment] =&gt; this is yet another comment
            [comment_date] =&gt; comment date
            [parent_id] =&gt; 0
            [children] =&gt; Array
                (
                    [5] =&gt; Array
                        (
                            [id] =&gt; 5
                            [comment_title] =&gt; comment title
                            [comment] =&gt; another comment
                            [comment_date] =&gt; comment date
                            [parent_id] =&gt; 2
                            [children] =&gt; Array
                                (
                                    [7] =&gt; Array
                                        (
                                            [id] =&gt; 7
                                            [comment_title] =&gt; comment title
                                            [comment] =&gt; Hey im a comment!
                                            [comment_date] =&gt; 1/1/1970
                                            [parent_id] =&gt; 5
                                            [children] =&gt; Array
                                                (
                                                    [8] =&gt; Array
                                                        (
                                                            [id] =&gt; 8
                                                            [comment_title] =&gt; comment title
                                                            [comment] =&gt; I disagree
                                                            [comment_date] =&gt; 1/1/1970
                                                            [parent_id] =&gt; 7
                                                            [children] =&gt; Array
                                                                (
                                                                    [9] =&gt; Array
                                                                        (
                                                                            [id] =&gt; 8
                                                                            [comment_title] =&gt; comment title
                                                                            [comment] =&gt; My comment is...
                                                                            [comment_date] =&gt; 1/1/1970
                                                                            [parent_id] =&gt; 8
                                                                            [children] =&gt; Array
                                                                                (
                                                                                    [10] =&gt; Array
                                                                                        (
                                                                                            [id] =&gt; 8
                                                                                            [comment_title] =&gt; comment title
                                                                                          [comment] =&gt; Hey im a comment!
                                                                                   [comment_date] =&gt; 1/1/1970
                                                                                            [parent_id] =&gt; 9
                                                                                            [depth] =&gt; 0
                                                                                            [child_count] =&gt; 0
                                                                                            [children] =&gt; 
                                                                                        )

                                                                                )

                                                                            [depth] =&gt; 1
                                                                            [child_count] =&gt; 1
                                                                        )

                                                                )

                                                            [depth] =&gt; 2
                                                            [child_count] =&gt; 1
                                                        )

                                                )

                                            [depth] =&gt; 3
                                            [child_count] =&gt; 1
                                        )

                                )

                            [depth] =&gt; 4
                            [child_count] =&gt; 1
                        )

                    [6] =&gt; Array
                        (
                            [id] =&gt; 6
                            [comment_title] =&gt; comment title
                            [comment] =&gt; This is the last comment
                            [comment_date] =&gt; 1/1/1970
                            [parent_id] =&gt; 2
                            [depth] =&gt; 0
                            [child_count] =&gt; 0
                            [children] =&gt; 
                        )

                )

            [depth] =&gt; 5
            [child_count] =&gt; 2
        )

)
</code></pre>

<p>Here is the markup i want to use. <a href="http://pastebin.com/MBppxiC7" rel="nofollow">http://pastebin.com/MBppxiC7</a></p>
