若仅仅只想隐藏子分类

<?php
$obj = $this->widget('Widget_Metas_Category_List');
if($obj->have()){
    while($obj->next()){
     if ($obj->levels === 0){
        echo '<li><a href="'.$obj->permalink.'">'.$obj->name.'</a></li>';
        }
    }
}
?>

子分类折叠,当鼠标移动到父分类后会显示出父分类下面的子分类

<?php
$categories = $this->widget('Widget_Metas_Category_List');
while($categories->next()){
if ($categories->levels === 0){
    $html = '<li><div class="category-parent">';
    $html .= '<a href="'.$categories->permalink.'">'.$categories->name.'</a>';
    echo $html;
    $children = $categories->getAllChildren($categories->mid);
    if (!empty($children)){
    $childCategoryHtml = '<div class="category-child"><ul class="widget-tile">';
    foreach ($children as $mid){
        $child = $categories->getCategory($mid);
        $childCategoryHtml .= '<li><a href="'.$child['permalink'].'">'.$child['name'].'</a></li>';
    }
    $childCategoryHtml  .= '</ul></div>';
    echo $childCategoryHtml;
    echo "</div></li>";
    }
}
}
?>



<style type="text/css">
.category-parent .category-child {display: none;position: absolute;background: #cd9a9a;}
.category-parent:hover .category-child {display: block;}
</style>