SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Enthusiast PHP_Nut's Avatar
    Join Date
    Aug 2001
    Location
    NY, USA
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Dynamic Navigation

    Hi all.. I was wondering how I could make a left navigation where it has a section that changes when u go to a different page..

    I am thinking of using variables. but I am unsure...

    here is what I was thinking of using
    PHP Code:
    <? 
    if ($blah == "services") { 
    ?> 

    these are my services and this information is only shown if the action is called (see below). 

    <? 
    } elseif ($blah == "products") { 
    ?> 

    these are my products, want to buy some? 

    <? 
    } else { 
    ?> 

    <h3>welcome to my main page</h3> 
    Check out my : 



    < a href="index.php3?blah=services">services< /a> 

    < a href="index.php3?blah=products">products< /a>
    am I wrong to use this?

    I think this might help some people to illustrate what I mean...
    http://www.saiyanz-rage.net/index2.p...bz&nav=nav/dbz

    look on the left menu see where it says Dragonball Z below Elite Affiliates..it changes if u go to a different page look here

    http://www.saiyanz-rage.net/index2.p...va&nav=nav/eva

    see it changed..how can I do that?
    Ian Gordon
    PHP & MySQL coder
    "Coding is like riding a bike, with a little practice, u won't hurt urself

  2. #2
    [Call me Bram] iBram007's Avatar
    Join Date
    Feb 2001
    Location
    Belgium
    Posts
    339
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think you are on the right way!

    If you want to work with a lot of text, you can include a txt file or even select the text from a database.

    text:
    PHP Code:
    <?
    if($blah == "1"){
    include(
    "1.txt");
    }
    ...
    ?>
    db (mysql):
    PHP Code:
    if($blah == "1"){
    $query mysql_query("SELECT * FROM a_database WHERE blah='1'");
    $handle mysql_fetch_array($query);

    echo 
    "<b>".$handle[title]."</b>";
    echo 
    "<br>";
    echo 
    $handle[text_part];

    }
    ... 

  3. #3
    SitePoint Enthusiast PHP_Nut's Avatar
    Join Date
    Aug 2001
    Location
    NY, USA
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    but how can I get it to change with the content?
    Ian Gordon
    PHP & MySQL coder
    "Coding is like riding a bike, with a little practice, u won't hurt urself

  4. #4
    [Call me Bram] iBram007's Avatar
    Join Date
    Feb 2001
    Location
    Belgium
    Posts
    339
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by PHP_Nut
    but how can I get it to change with the content?
    How do you mean?

    You only have to set in in the link:

    page.php?blah=1

  5. #5
    SitePoint Addict
    Join Date
    Sep 2000
    Location
    Ontario, Canada
    Posts
    320
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you are currently in the "Dragonball Z" section for example, is there a way to disable the link to it in the menu?
    Jason Dulberg
    Extreme MTB
    http://extreme.nas.net

  6. #6
    SitePoint Enthusiast PHP_Nut's Avatar
    Join Date
    Aug 2001
    Location
    NY, USA
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok say this is the menu for Index.php

    Menu 1 Title
    link
    link
    link

    Menu 2 tilte
    link
    link
    link

    I want Menu 1 to change everytime the page changes the menu 1 to change..is there a way i can do that? and can I add the content for that section with the link as well..

    so that Menu 1 adds content 1
    and when Menu 1 change to say Menu 1a then it adds content 1a ?
    Ian Gordon
    PHP & MySQL coder
    "Coding is like riding a bike, with a little practice, u won't hurt urself

  7. #7
    chown linux:users\ /world Hartmann's Avatar
    Join Date
    Aug 2000
    Location
    Houston, TX, USA
    Posts
    6,455
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    Basically have a system of

    PHP Code:
    <?

    switch($link)
    {

     case 
    "1"showcontent 1;
     break;

     case 
    "1a"showcontent 1a;
     break;

     default: 
    show default content;
    }

    ?>
    You can use this continuosly... and just make you links look like this:

    PHP Code:

    <A HREF="main.php?link=1">Menu</A>
    <
    A HREF="main.php?link=1a">1</a


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •