menu link
Results 1 to 7 of 7

Thread: menu link

  1. #1
    Senior Member
    Join Date
    Apr 2005
    Posts
    1,250

    menu link

    i have a page called mymenu.php

    PHP Code:
    <a href="index.php">Home</a>
    <
    a href="shoes/index.php">Shoes</a>
    <
    a href="pants/index.php">Pants</a
    This works from the home page but when in the shoes folder it tries going

    <a href="shoes/pants/index.php">Pants</a>

    how can i get around this?

  2. #2
    Beware: Crazy Scientist leatherback's Avatar
    Join Date
    Mar 2002
    Location
    Small border town between Netherlands and Germany
    Posts
    5,395
    e.g.:
    <a href="www.domain.com/index.php">home</a>
    Php 4.* to 5.*. A small step for programmers. But a leap for me!

  3. #3
    Senior Member
    Join Date
    Apr 2005
    Posts
    1,250
    is there another way so its not dependant on the server name?

  4. #4
    Senior Member anoopmail's Avatar
    Join Date
    May 2005
    Location
    Hell
    Posts
    241
    PHP Code:
    <a href="\index.php">Home</a>
    <
    a href="\shoes/index.php">Shoes</a>
    <
    a href="\pants/index.php">Pants</a

  5. #5
    newbie php developer Damian_'s Avatar
    Join Date
    Jun 2011
    Location
    london
    Posts
    93
    <domain name>

    <a href="<$domain name>\index.php">Home</a>
    <a href="<$domain name>\shoes/index.php">Shoes</a>
    <a href="<$domain name>\pants/index.php">Pants</a>

    would this also work???

    so you can have a global variable if you were thinking of moving over to a new domain name you can just change it on one file?

    sorry if that seems silly, i am also a newbie at this

  6. #6
    Pna lbh ernq guvf¿
    Join Date
    Jul 2004
    Location
    Kansas City area
    Posts
    19,429
    Quote Originally Posted by Damian_ View Post
    would this also work???
    No, because you'd be missing the protocol (e.g. 'http://' or 'https://') to make a valid URL. Otherwise, the browser is just going to consider it as a relative link and you'll end up trying to go to http://yourdomain.com/yourdomain.com/shoes/index.php.

    Also, not sure why backslashes are appearing in the links - note that they should instead be forward slashes.

  7. #7
    newbie php developer Damian_'s Avatar
    Join Date
    Jun 2011
    Location
    london
    Posts
    93
    ah yes that makes sense, oh the backslashes are just copied and pasted from previous post, too lazy to re-write all that

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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