tags:

views:

37

answers:

1

I need to highlight the node value when I select it.how can I wrirte code for that in php my code is

function generate_menu($parent) {
    $has_childs = false;
    global $menu_array;
    foreach($menu_array as $key => $value) {
        if ($value['parentid'] == $parent) {
            if ($has_childs === false) {                
                $has_childs = true;
                $menu .= '<ul>';
            }
            $clor = 'black';

            if(($_GET['id']>0) &&($key == $_GET['id'])) {
                $clor = '#990000';
            }
            $chld =  generate_menu($key);
            $cls = ($chld != '')? 'folder' : 'file';
            $menu .= '<li><span class="'.$cls.'" color='.$clor.'>&nbsp;'  . $value['humanid'].'-'.$value['title'] . ' <a href="index.php?id='.$key.'"><img src="images/edit.png" alt=" Edit" title="Edit"/></a></span>';

            $menu .= $chld;
            $menu .= '</li>';
        }
    }
    if ($has_childs === true) $menu .= '</ul>';
    return $menu ;
}
A: 

I think you want to render some pieces of the list in black and the others in different color? It's HTML question then. And this stuff is not going to work:

<span class="someclass" color='somecolor'>Text</span>

Try:

$menu .= '<li><span class="'.$cls.'" style="color:"'.$clor.'">(the rest of your text here)</span>';

or

$menu .= '<li><span class="'.$cls.'" style="font-color:"'.$clor.'">(the rest of your text here)</span>';

If it solves your questions, you can look up some tutorials about CSS styles (hint: search for background-color, font-color, text-decoration, font-weight).

eyescream