tabbed navigation

Discussion in 'HTML' started by mcnewsxp, Nov 3, 2010.

  1. mcnewsxp

    mcnewsxp Guest

    i have setup css and am using <div><ul> <li> tags for my tabbed navigation.
    i'd like to put the menu options in an include file. i have an <li
    class="active">, but i don't know how to set the "active" page so i am hard
    coding the menu in every page.
    without asking me for a URL can someone tell me how to make this work.
    tia,
    mcnewsxp
     
    mcnewsxp, Nov 3, 2010
    #1
    1. Advertising

  2. Gazing into my crystal ball I observed "mcnewsxp"
    <> writing in
    news:iarqt2$i25$-september.org:

    > i have setup css and am using <div><ul> <li> tags for my tabbed
    > navigation. i'd like to put the menu options in an include file. i
    > have an <li class="active">, but i don't know how to set the "active"
    > page so i am hard coding the menu in every page.
    > without asking me for a URL can someone tell me how to make this work.
    > tia,
    > mcnewsxp
    >
    >


    You could do it server side. I do this all the time.

    <?php
    $thisurl = "contact.php";

    ?>
    <div id="nav">
    <ul>
    <li><?php nav("index.php","Home",$thisurl) ?></li>
    <li><?php nav("contact.php","Contact",$thisurl) ?></li>
    <li><?php nav("about.php","About",$thisurl) ?></li>
    </ul>
    </div>

    <?php funtion nav($uri,$page,$thisurl)

    {

    if($uri==$thisurl)
    {echo "<a href='$uri' class='active'>$page</a>";}
    else
    {echo "<a href='$uri'>$page</a>";}
    }
    ?>

    }

    Mine is actually a little more elaborate than that, but I think you get
    the idea.
    --
    Adrienne Boswell at Home
    Arbpen Web Site Design Services
    http://www.cavalcade-of-coding.info
    Please respond to the group so others can share
     
    Adrienne Boswell, Nov 3, 2010
    #2
    1. Advertising

  3. mcnewsxp

    mcnewsxp Guest

    "Adrienne Boswell" <> wrote in message
    news:Xns9E2556E5BF4B3arbpenyahoocom@85.214.73.210...
    > Gazing into my crystal ball I observed "mcnewsxp"
    > <> writing in
    > news:iarqt2$i25$-september.org:
    >
    >> i have setup css and am using <div><ul> <li> tags for my tabbed
    >> navigation. i'd like to put the menu options in an include file. i
    >> have an <li class="active">, but i don't know how to set the "active"
    >> page so i am hard coding the menu in every page.
    >> without asking me for a URL can someone tell me how to make this work.
    >> tia,
    >> mcnewsxp
    >>
    >>

    >
    > You could do it server side. I do this all the time.
    >
    > <?php
    > $thisurl = "contact.php";
    >
    > ?>
    > <div id="nav">
    > <ul>
    > <li><?php nav("index.php","Home",$thisurl) ?></li>
    > <li><?php nav("contact.php","Contact",$thisurl) ?></li>
    > <li><?php nav("about.php","About",$thisurl) ?></li>
    > </ul>
    > </div>
    >
    > <?php funtion nav($uri,$page,$thisurl)
    >
    > {
    >
    > if($uri==$thisurl)
    > {echo "<a href='$uri' class='active'>$page</a>";}
    > else
    > {echo "<a href='$uri'>$page</a>";}
    > }
    > ?>
    >
    > }
    >
    > Mine is actually a little more elaborate than that, but I think you get
    > the idea.
    > --


    that's what i'm looking for. mine will be classic ASP for this one tho.
    i'll try and adapt you code.
     
    mcnewsxp, Nov 3, 2010
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rob
    Replies:
    1
    Views:
    347
    Jim Corey
    May 27, 2004
  2. RCS
    Replies:
    1
    Views:
    446
    =?Utf-8?B?Q2hyaXMgTG92ZQ==?=
    Dec 21, 2005
  3. kaibo

    Tabbed navigation and CSS

    kaibo, Dec 28, 2005, in forum: HTML
    Replies:
    3
    Views:
    584
    kaibo
    Dec 29, 2005
  4. Laurahn
    Replies:
    3
    Views:
    935
    Steven Cheng[MSFT]
    Feb 6, 2007
  5. Replies:
    1
    Views:
    118
    shimmyshack
    May 5, 2007
Loading...

Share This Page