Community & Support

Is this a themeing issue or problem with my code?

I made the following script to output a list of all the terms in a vocabulary in a tree like structure. But the problem with is that the output of the bulleted list is pain and is not in a hierarchical method. Could be can issue with my code, or it could be I need to style this output using CSS?

Display of my term hierarchy: http://img35.imageshack.us/img35/7240/50390612.jpg
Display of my output: http://img182.imageshack.us/img182/6231/41267419.jpg

<?php
/**
* Prints an unordered list of the all the terms in a vocabulary
*/

$vid = 2;
print_taxonomy_terms($vid);    
function
get_children_terms($term)
{
   
$children = taxonomy_get_children($term->tid, $vid);
    if(
$children)
    {
        print
'<ul>';       
        foreach(
$children as $child)
        {
            print
'<li>'.l($child->name, 'taxonomy/term/'.$child->tid).'</li>';
           
get_children_terms($child);
        }
        print
'</ul>';
    }
}   

function
print_taxonomy_terms($vid)
{
   
$terms = taxonomy_get_tree($vid, $parent = 0, $depth = -1, $max_depth = 1);
    if(
$terms)
    {
        print
'<ul>';
        foreach (
$terms as $term)
        {
            print
'<li>'.l($term->name, 'taxonomy/term/'.$term->tid).'</li>';
           
get_children_terms($term);
        }
        print
'</ul>';
    }
}
?>

Comments

Still haven't figured this

Still haven't figured this out. Anyone out there that might know?

nobody click here