SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    May 2006
    Location
    Ljubljana
    Posts
    241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    $_server['php_self']

    Hello..

    I have index.php, which has a few includes. Now I would link to get $_SERVER['PHP_SELF'] in one include, and I'd like to get filename of that file but variable will return 'index.php'. How is that possible to achieve?

    Example:


    Code:
    index.php:
    include_once(folder/some_inc.php);
    
    some_inc.php:
    I want it to return the path to this file from index.php (so 'folder/some_inc.php')
    Thanks a lot for help
    Regards

  2. #2
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    considering the index.php file already knows the path to 'folder/some_inc.php'
    i think it would be easiest to just set a variable.
    PHP Code:
    $var 'folder/';
    include_once(
    $var 'some_inc.php'); 
    another way which doesnt depend upon another file setting the variable:
    PHP Code:
    // some_inc.php
    $dir dirname(__FILE__); 
    http://www.php.net/manual/en/languag...predefined.php


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
  •