#3 Automatic path detection

Wishlist
closed-later
nobody
Other (26)
1
2000-06-09
2000-04-11
No

I include the following bit of code in all of my PHP scripts so that they know where they are being called from. This way I do not have to create a configuration variable to hold the path which will break the app when moved without updating the variable. It would be nice if you modified the code below and included it into new versions.

# Generate the local paths to be used
if (! isset ($SELF)) {
# Make some variables to point back to me
if ($PATH_INFO) {
$SELF = ereg_replace ($PATH_INFO, "", $PHP_SELF);
$SELF_BASE = ereg_replace ("/[^/]*$", "" , $SELF);
$IMAGES = sprintf ("%s/images", $SELF_BASE);
$SELF .= "$PATH_INFO";
} else {
$SELF = $PHP_SELF;
$SELF_BASE = ereg_replace ("/[^/]*$", "" , $SELF);
$IMAGES = sprintf ("%s/images", $SELF_BASE);
}
}

Discussion

  • David Norman

    David Norman - 2000-04-12
    • status: Error - status not found --> open-later
     
  • -mat- filid brandy

    When translating the rest, I'll have a look.
    -mat-

     
  • -mat- filid brandy

    • priority: 5 --> 1
     
  • -mat- filid brandy

    obsolete.
    -mat-

     
  • -mat- filid brandy

    • status: open-later --> closed-later
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks