Results 1 to 3 of 3

Thread: Files filename

  1. #1

    Thread Starter
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349

    Files filename

    Is there a way to find out what file the user is viewing?

    I'm hoping there is a fuction for this, its not a simple as as you might think. I have a set of files that the user can open, Say: index.php, request.php, staff.php, ect.... But when those files are opened they will all include the template.php file and inside this I want to beable to tell what the original file was entered. Also the template file sometimes includes files and I will need to still access the file name from these too.

    I know I could do this with a variable in every file but I was wondering if there was a function that could do it?

    Thanx
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  2. #2
    Frenzied Member numtel's Avatar
    Join Date
    Apr 2000
    Location
    CA
    Posts
    1,163
    PHP Code:
      <? 
    $currentFile = $_SERVER["SCRIPT_NAME"]; 
      $parts = Explode('/', $currentFile); 

      print $parts[count($parts) - 1]; 
    ?>
    That should do the trick.

  3. #3

    Thread Starter
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349
    Thanx, just what I needed.
    Last edited by Electroman; May 9th, 2004 at 01:48 PM.
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

Posting Permissions

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



Click Here to Expand Forum to Full Width