SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Nov 2005
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Ho would i go from /job4/web_safety/aboutus.php to aboutus ???

    Hey all hope your having a good weekend.

    Quick question.

    if i do

    Code:
    <?php		
    $url = $_SERVER['SCRIPT_NAME'];
    echo $url;
    ?>
    and it returns /job4/web_safety/aboutus.php how would i set a variable with just aboutus ?

    Many thanks

  2. #2
    SitePoint Addict
    Join Date
    Aug 2005
    Posts
    207
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    basename();

    PHP Code:
    <?php

    $url 
    basename $_SERVER['SCRIPT_NAME'] );

    echo 
    $url;

    ?>

  3. #3
    SitePoint Zealot krt's Avatar
    Join Date
    Sep 2005
    Location
    Australia
    Posts
    114
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    <?php

    $name 
    basename($_SERVER['PHP_SELF'], '.php');

    // $name would now have the value "aboutus"

    ?>

  4. #4
    SitePoint Member
    Join Date
    Nov 2005
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you so much to both of you, did just the trick


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
  •