getting base directory

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Aaron Gray

    getting base directory

    I want a function that gives me the base directory of a script.

    So when given the script file '/var/www/test.org/html/test/index.php' from
    $_SERVER['SCRIPT_FILENAM E'] it returns '/var/www/test.org/html/test/'.

    I am wondering the neatest way to do this ?

    I cannot find a reverse string search function.

    Many thanks in advance,

    Aaron


  • Steve Foley

    #2
    Re: getting base directory

    "Aaron Gray" <ang.usenet@gma il.comwrote in message
    news:65horiF2g0 v0aU1@mid.indiv idual.net...
    I want a function that gives me the base directory of a script.
    >
    So when given the script file '/var/www/test.org/html/test/index.php' from
    $_SERVER['SCRIPT_FILENAM E'] it returns '/var/www/test.org/html/test/'.
    >
    I am wondering the neatest way to do this ?
    >
    I cannot find a reverse string search function.
    >
    Many thanks in advance,
    >
    Aaron
    >
    >
    basename

    Comment

    • Aaron Gray

      #3
      Re: getting base directory

      "Steve Foley" <steve.foley@at t.DELETE.netwro te in message
      news:d5OIj.1489 9$oE1.7400@trnd ny09...
      "Aaron Gray" <ang.usenet@gma il.comwrote in message
      news:65horiF2g0 v0aU1@mid.indiv idual.net...
      >I want a function that gives me the base directory of a script.
      >>
      >So when given the script file '/var/www/test.org/html/test/index.php'
      >from
      >$_SERVER['SCRIPT_FILENAM E'] it returns '/var/www/test.org/html/test/'.
      >>
      >I am wondering the neatest way to do this ?
      >>
      >I cannot find a reverse string search function.
      >>
      >Many thanks in advance,
      >>
      >Aaron
      >>
      >>
      >
      basename
      That was quick :)

      Thanks,

      Aaron


      Comment

      • Aaron Gray

        #4
        Re: getting base directory

        "Steve Foley" <steve.foley@at t.DELETE.netwro te in message
        news:d5OIj.1489 9$oE1.7400@trnd ny09...
        "Aaron Gray" <ang.usenet@gma il.comwrote in message
        news:65horiF2g0 v0aU1@mid.indiv idual.net...
        >I want a function that gives me the base directory of a script.
        >>
        >So when given the script file '/var/www/test.org/html/test/index.php'
        >from
        >$_SERVER['SCRIPT_FILENAM E'] it returns '/var/www/test.org/html/test/'.
        >>
        >I am wondering the neatest way to do this ?
        >>
        >I cannot find a reverse string search function.
        >>
        >Many thanks in advance,
        >>
        >Aaron
        >>
        >>
        >
        basename
        You mean dirname not basename !:)

        Aaron


        Comment

        • Krustov

          #5
          Re: getting base directory

          <comp.lang.ph p>
          <Aaron Gray>
          <Wed, 2 Apr 2008 17:04:44 +0100>
          <65hpe8F2fl881U 1@mid.individua l.net>
          basename
          >
          You mean dirname not basename !:)
          >
          $batman=pathinf o($doc,PATHINFO _DIRNAME);

          Havent actually tried it myself - its just a snippet of code i have .


          --

          Comment

          • Aaron Gray

            #6
            Re: getting base directory

            "Krustov" <me@privacy.net wrote in message
            news:MPG.225dc3 86ad8c913b98b37 0@news.newsread er.com...
            <comp.lang.ph p>
            <Aaron Gray>
            <Wed, 2 Apr 2008 17:04:44 +0100>
            <65hpe8F2fl881U 1@mid.individua l.net>
            >
            basename
            >>
            >You mean dirname not basename !:)
            >>
            >
            $batman=pathinf o($doc,PATHINFO _DIRNAME);
            >
            Havent actually tried it myself - its just a snippet of code i have .
            It works I have used it in my utils.

            Aaron


            Comment

            • Steve Foley

              #7
              Re: getting base directory

              "Aaron Gray" <ang.usenet@gma il.comwrote in message
              news:65hpe8F2fl 881U1@mid.indiv idual.net...
              >
              You mean dirname not basename !:)
              >
              Aaron
              Yup.

              Comment

              Working...