This is a discussion on Multilevel site navigation within the PHP Language forums, part of the PHP Programming Forums category; I am quite new to PHP and I my question is quite simple, but I have not found any sufficient ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I am quite new to PHP and I my question is quite simple, but I have not
found any sufficient answer even after spending several hours in google or reviewing this group. I am planning a website, which is using an index.php, which has a structure of the layout. In this script I am planning to have several include() -statements. One to generate the site navigation on the left margin. Another to generate content in the mainarea of the page. The content is stored in separate html-docs or php.-scripts, which are inserted into index-page. Variables, that are needed to pick the right content can be passed in the url. I will not use any database, because the content is quite static, but by using php I am anyway looking for easier maintenance and updating. My trouble is that I don't know how to generate a navigation that has three levels, like this: Item1 in first level ...Item1 in second level ....Item2 in second level .......Item1 in third level .......Item2 in third level .......Item3 in third level ....Item3 in second level Item2 in first level Item3 in first level Item4 in first level ....and so on.... When user enters the site, only main laevel's links are visible. When user clicks an item on the first level, the content is updated with the frontpage of this topic, but at the same time appropriate second level links are displayed. And so on. Of course I will use css to make links on different levels distinctive, so there must be a way to set different class-value in <a> tag in different levels. I hope that you didn't fall asleep while reading this. If I failed to give appropriate information, please ask. Oll¡maX! |
|
|||
|
take a look at my site, is that what you are talking about?
there are differnt levels to the tools menu -- Mike Bradley http://www.gzentools.com -- free online php tools "OllimaX" <ollimax@sunpoint.net> wrote in message news:opr1s5nusc5twr0h@news.inet.fi... > I am quite new to PHP and I my question is quite simple, but I have not > found any sufficient answer even after spending several hours in google or > reviewing this group. > > I am planning a website, which is using an index.php, which has a structure > of the layout. > In this script I am planning to have several include() -statements. > One to generate the site navigation on the left margin. > Another to generate content in the mainarea of the page. The content is > stored in separate html-docs or php.-scripts, which are inserted into > index-page. > Variables, that are needed to pick the right content can be passed in the > url. > > I will not use any database, because the content is quite static, but by > using php I am anyway looking for easier maintenance and updating. > > My trouble is that I don't know how to generate a navigation that has three > levels, like this: > Item1 in first level ...Item1 in second level > ...Item2 in second level > ......Item1 in third level > ......Item2 in third level > ......Item3 in third level > ...Item3 in second level > Item2 in first level Item3 in first level Item4 in first level > ...and so on.... > > When user enters the site, only main laevel's links are visible. When user > clicks an item on the first level, the content is updated with the > frontpage of this topic, but at the same time appropriate second level > links are displayed. And so on. > Of course I will use css to make links on different levels distinctive, so > there must be a way to set different class-value in <a> tag in different > levels. > > I hope that you didn't fall asleep while reading this. If I failed to give > appropriate information, please ask. > > Oll¡maX! |
|
|||
|
CountScubula <me@scantek.hotmail.com> kirjoitti Thu, 15 Jan 2004 09:38:48
GMT: > take a look at my site, is that what you are talking about? > there are differnt levels to the tools menu yes, more or less the same. You have the encoder tools expanded when entering the site, I wouldn't have anything expanded at the first place, but that's a minor problem of course. Also I need to have three levels instead of yours two. I can see you have done that with different scripts on each category. That's a useful idea, although I was looking for a solution that one script takes hold of each level and category. I have made some tests with dimensional arrays like this: $NAVI=array( 'History'=> array('founding'=>'founding.php','sportsactivities '=>'sportacts.php'), 'Sports'=> array('wrestling'=>array('licensepolicy'=>'license s.php','Wrestlers'=>'team.php') ,'bowling'=>'bowling'); In the array, key should be printed as a link, and value should be printed as href. The reason why tehy have to be different is that the page is actually going to be in finnish and there will be extended characters (like ä and ö) in linktext, so that I can't use the same text in href. But iterating through this is a bit complicated, because at the same time you have to take care that the right sections are expanded and I don't know php well enought to make it func. Olli Mäntyranta |
|
|||
|
Actauly the differtn scripts have nothing to do with it really.
The menu is one include file, and it looks for a cookie, example at the top of any page i have an include head stuff., in it $sm = $_COOKIE['sm']; //sm = show menu then in my include menu file: if ($sm != "item1") { print menu 1 title } else { print Menu 1 expanded } I just have a few of these so, when you clicked on one of the menu options, the following page did this setcookie("sm","item_name"); $sm = "item_name"; include (menu stuff) you could do this with two or more levels by setting more cookies. Now I know this is not the best way or wrost way to do it, but, it works for me :) -- Mike Bradley http://www.gzentools.com -- free online php tools "OllimaX" <ollimax@sunpoint.net> wrote in message news:opr1tfkrbb5twr0h@news.inet.fi... > CountScubula <me@scantek.hotmail.com> kirjoitti Thu, 15 Jan 2004 09:38:48 > GMT: > > > take a look at my site, is that what you are talking about? > > there are differnt levels to the tools menu > > > yes, more or less the same. You have the encoder tools expanded when > entering the site, I wouldn't have anything expanded at the first place, > but that's a minor problem of course. Also I need to have three levels > instead of yours two. > I can see you have done that with different scripts on each category. > That's a useful idea, although I was looking for a solution that one script > takes hold of each level and category. I have made some tests with > dimensional arrays like this: > > $NAVI=array( 'History'=> > array('founding'=>'founding.php','sportsactivities '=>'sportacts.php'), > 'Sports'=> > array('wrestling'=>array('licensepolicy'=>'license s.php','Wrestlers'=>'team. php') > ,'bowling'=>'bowling'); > > In the array, key should be printed as a link, and value should be printed > as href. The reason why tehy have to be different is that the page is > actually going to be in finnish and there will be extended characters (like > ä and ö) in linktext, so that I can't use the same text in href. > > But iterating through this is a bit complicated, because at the same time > you have to take care that the right sections are expanded and I don't know > php well enought to make it func. > > Olli Mäntyranta |