This particular image demonstrates a vertical menu that is expanded. I am looking to display only the parent tag initially and upon hovering, show the next level and so forth.
function display_children($parent, $level, $categoryModel) {
$result = $categoryModel->get_category($parent);
echo "<ul>";
foreach ($result as $row) :
if ($row['Count'] > 0) {
echo "<li><a href='" . base_url() . "/index.php/advertisement/category/" . $row['category_id'] . "'>" . $row['category_name'] . "</a>";
display_children($row['category_id'], $level + 1, $categoryModel);
echo "</li>";
} elseif ($row['Count'] == 0) {
echo "<li><a href='" . base_url() . "/index.php/advertisement/category/" . $row['category_id'] . "'>" . $row['category_name'] . "</a></li>";
}
else;
endforeach;
echo "</ul>";
}
The above code is what I have written, and now I require CSS for it. Since it involves recursive logic, I am feeling unsure about how to proceed. Most of the CSS resources I found were for horizontal menu listing, but I specifically need a vertical menu layout.