Jump to content

Can anyone help me to make my menu able to hide/show? Thanks a lot.


zac1987

Recommended Posts

Currently my this menu can only show but cannot hide. when I click on a category, it shows a list of items. When I click again the category, the list of items must hide back. How is the code to hide back the list of items? Could anyone help me? Thanks. I am newbie in PHP, so please show me the code in more detail. Thanks.untitled.PNG

 

Below is the coding. Hope someone can help me modify it so that when I click 2nd time the category, it will hide the items. click 3rd time, it will show items. click 4th time, it will hide...

 

function public_navigation($sel_category, $sel_item){

$output = "<div style=\"overflow:auto; height:435px; width:250px;\" name=\"content\" ><ul class=\"categories\">";

$category_set = get_all_categories();

while ($category = mysql_fetch_array($category_set)) {

$output .= "<li";

if ($category["id"] == $sel_category['id']){ $output .= " class=\"selected\""; }

$output .= "><a href=\"index.php?category=" . urlencode($category["id"]) . "\">{$category["category"]}</a></li>";

 

if ($category["id"] == $sel_category['id'] || $category["id"] == $sel_item['category_id']){

$item_set = get_items_for_categories($category["id"]);

 

$output .= "<ul class=\"items\">";

while ($item = mysql_fetch_array($item_set)) {

$output .= "<li";

if ($item["id"] == $sel_item['id']){$output .= " class=\"selected\"";}

$output .= "><a href=\"index.php?item=" . urlencode($item["id"]) . "\">{$item["item"]}</a></li>";

}

$output .= "</ul>";

}

}

$output .= "</ul></div>";

return $output;

}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.