Multilevel site navigation

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • OllimaX

    Multilevel site navigation

    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

    #2
    Re: Multilevel site navigation

    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@sunpoi nt.net> wrote in message
    news:opr1s5nusc 5twr0h@news.ine t.fi...[color=blue]
    > 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[/color]
    structure[color=blue]
    > 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[/color]
    three[color=blue]
    > 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![/color]


    Comment

    • OllimaX

      #3
      Re: Multilevel site navigation

      CountScubula <me@scantek.hot mail.com> kirjoitti Thu, 15 Jan 2004 09:38:48
      GMT:
      [color=blue]
      > take a look at my site, is that what you are talking about?
      > there are differnt levels to the tools menu[/color]


      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.ph p','sportsactiv ities'=>'sporta cts.php'),
      'Sports'=>
      array('wrestlin g'=>array('lice nsepolicy'=>'li censes.php','Wr estlers'=>'team .php')
      ,'bowling'=>'bo wling');

      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
      &auml; and &ouml;) 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

      Comment

      • CountScubula

        #4
        Re: Multilevel site navigation

        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@sunpoi nt.net> wrote in message
        news:opr1tfkrbb 5twr0h@news.ine t.fi...[color=blue]
        > CountScubula <me@scantek.hot mail.com> kirjoitti Thu, 15 Jan 2004 09:38:48
        > GMT:
        >[color=green]
        > > take a look at my site, is that what you are talking about?
        > > there are differnt levels to the tools menu[/color]
        >
        >
        > 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[/color]
        script[color=blue]
        > takes hold of each level and category. I have made some tests with
        > dimensional arrays like this:
        >
        > $NAVI=array( 'History'=>
        > array('founding '=>'founding.ph p','sportsactiv ities'=>'sporta cts.php'),
        > 'Sports'=>
        >[/color]
        array('wrestlin g'=>array('lice nsepolicy'=>'li censes.php','Wr estlers'=>'team .
        php')[color=blue]
        > ,'bowling'=>'bo wling');
        >
        > 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[/color]
        (like[color=blue]
        > &auml; and &ouml;) 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[/color]
        know[color=blue]
        > php well enought to make it func.
        >
        > Olli Mäntyranta[/color]


        Comment

        Working...