954,597 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Help with collapsing menu

Hi there, I'm a newbie, and I would really like some help regarding this issue I have with my menu.

First the code:

[CODE PHP]
01 function public_navigation($sel_subject, $sel_page, $public = true) {
02 $output = '';
03 $subject_set = get_all_subjects($public);
04 while ($subject = mysql_fetch_array($subject_set)) {
05 $output .= "{$subject["menu_name"]}";
09 if ($subject["id"] == $sel_subject['id'] || $subject["id"] == $sel_page['subject_id']) {
10 $page_set = get_pages_for_subject($subject["id"]);
11 $output .= "";
12 while ($page = mysql_fetch_array($page_set)) {
13 $output .= "{$page["menu_name"]}
";
17 }
18 $output .= "";
19 }
20 }
21 $output .= "";
22 return $output;
23 }
[/CODE]

Let me explain:
If I select a subject and if this subject has pages under it, the menu will expand and it will show all available pages in the selected subject. Fine!
However...if I then proceed to click on a page within the subject, the page does select but the menu collapses, and thus will not show all available pages in the subject anymore.
This means, in order to visit another page within the selected subject, I will first have to return to the selected subject (to open the menu) to be able to select another page inside the subject.

Now:
I did fool around a bit but could not get a satisfactory result. I added to line 09 in the if statement : || $subject["id"] == $sel_page['subject_id'].
Now the menu does not collapse on selecting a page, but if for example the $subject['id'] == 2 & $sel_page['subject_id'] ==2, (wich is true in this case) then both will be selected if I select either of them.

What do I need to do to solve this problem?

Screenshot:
http://xtence.com.pt/images/screenshot.jpg

ajfresh
Newbie Poster
2 posts since Nov 2010
Reputation Points: 10
Solved Threads: 0
 

I figured it out!

09

if ($subject["id"] == $sel_subject['id'] || $subject["id"] == $sel_page['subject_id'])
ajfresh
Newbie Poster
2 posts since Nov 2010
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: