www.webdeveloper.com
Results 1 to 4 of 4

Thread: is $PHP_SELF equal to $page?

  1. #1
    Join Date
    Nov 2002
    Location
    Essex / Kent, UK
    Posts
    89

    Question is $PHP_SELF equal to $page?

    Can somebody please tell me how I can get this to work?
    It should compare the active link with the button's link then display the button accordingly.

    This file is 'included' in every page.

    CODE:

    function header ()
    {
    <div <?if ($PHP_SELF == $thisPage){echo "class=\"activeLink\"";} else { ?> class="button" onMouseOver="this.style.background='#FFFFFF'; this.style.border='1px dashed #000000'" onMouseOut="this.style.background='#CCCCFF'; this.style.border='1px solid #CCCCFF'"<?}?>>
    Home
    </div>
    <!--Insert other buttons here-->
    }

  2. #2
    Join Date
    Dec 2002
    Location
    High on life
    Posts
    10,104
    Huh? What does $thisPage equal?

    Personal website http://www.ryanbrill.com/
    Business website: http://www.infinitywebdesign.com/
    TypeSpace http://www.typespace.org/

    I reject your reality and substitute it with my own!

  3. #3
    Join Date
    Nov 2002
    Location
    Essex / Kent, UK
    Posts
    89
    $thisPage = "index.php";

    ...or whatever page the button links to.

    I know this button doesn't go anywhere; normally it has an anchor either side of "Home".

    Even if you replace $thisPage with "index.php", $PHP_SELF doesn't seem to equal it when the file is index.php.

  4. #4
    Join Date
    Dec 2002
    Location
    High on life
    Posts
    10,104
    That is because PHP self would return the path of the page. ie. /path/to/index.php or, if index.php is in the root directory, /index.php. Note the preceding slash.

    Personal website http://www.ryanbrill.com/
    Business website: http://www.infinitywebdesign.com/
    TypeSpace http://www.typespace.org/

    I reject your reality and substitute it with my own!

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
  •  
HTML5 Development Center



Recent Articles