print_r($tree)
result is
Array
(
[0] => stdClass Object
(
[tid] => 6
[vid] => 2
[name] => parent one
[description] =>
[format] => filtered_html
[weight] => 0
[depth] => 0
[parents] => Array
(
[0] => 0
)
)
[1] => stdClass Object
(
[tid] => 14
[vid] => 2
[name] => child one
[description] =>
[format] => filtered_html
[weight] => 0
[depth] => 1
[parents] => Array
(
[0] => 6
)
)
[2] => stdClass Object
(
[tid] => 13
[vid] => 2
[name] => child tow
[description] =>
[format] => filtered_html
[weight] => 0
[depth] => 1
[parents] => Array
(
[0] => 6
)
)
[3] => stdClass Object
(
[tid] => 7
[vid] => 2
[name] => parent two
[description] =>
[format] => filtered_html
[weight] => 1
[depth] => 0
[parents] => Array
(
[0] => 0
)
)
[4] => stdClass Object
(
[tid] => 18
[vid] => 2
[name] => child three
[format] => filtered_html
[weight] => 0
[depth] => 1
[parents] => Array
(
[0] => 7
)
)
[5] => stdClass Object
(
[tid] => 19
[vid] => 2
[name] => child four
[format] => filtered_html
[weight] => 0
[depth] => 1
[parents] => Array
(
[0] => 7
)
)
[6] => stdClass Object
(
[tid] => 8
[vid] => 2
[name] =>parent
[description] =>
[format] => filtered_html
[weight] => 2
[depth] => 0
[parents] => Array
(
[0] => 0
)
)
[7] => stdClass Object
(
[tid] => 4
[vid] => 2
[name] => parent
[description] =>
[format] => filtered_html
[weight] => 3
[depth] => 0
[parents] => Array
(
[0] => 0
)
)
i want to output the hml like the following:
<li class='parent'><a href="#">parent one</a><span></span>
<ul class='haschild'>
<li><a href="#">child one/a></li>
<li><a href="#">child two</a></li>
</ul>
</li>
<li class='parent'><a href="">parent two</a><span></span>
<ul class='haschild'>
<li><a href="">child three</a></li>
<li><a href="9">child four</a></li>
</ul>
</li>
<li><a href="">parent</a></li>
<li><a href="">parent</a></li>