Find the name of the current folder

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

    #1

    Find the name of the current folder

    For use in a install.php

    What would be the best way to do it .

  • Kim André Akerø

    #2
    Re: Find the name of the current folder

    Krustov wrote:
    [color=blue]
    > For use in a install.php
    >
    > What would be the best way to do it .[/color]

    Probably with getcwd().
    Gets the current working directory


    --
    Kim André Akerø
    - kimandre@NOSPAM betadome.com
    (remove NOSPAM to contact me directly)

    Comment

    • Krustov

      #3
      Re: Find the name of the current folder

      <comp.lang.ph p , Kim André Akerø , kimandre@NOSPAM betadome.com>
      <3theu2Ft4048U1 @individual.net >
      <10 Nov 2005 17:39:14 GMT>
      [color=blue][color=green]
      > > For use in a install.php
      > >
      > > What would be the best way to do it .[/color]
      >
      > Probably with getcwd().
      > http://php.net/getcwd
      > [/color]

      Sounds good to me - thank you .

      Comment

      • Krustov

        #4
        Re: Find the name of the current folder

        <comp.lang.ph p , Krustov , krusty@krustov. co.uk.INVALID>
        <MPG.1ddd991e1a 81c0c498a68a@no-cancel.newsread er.com>
        <Thu, 10 Nov 2005 17:52:02 -0000>
        [color=blue][color=green][color=darkred]
        > > > For use in a install.php
        > > >
        > > > What would be the best way to do it .[/color]
        > >
        > > Probably with getcwd().
        > > http://php.net/getcwd
        > >[/color]
        >
        > Sounds good to me - thank you .
        >[/color]

        As I only need/want the last folder name and as i'm still a bit of a php
        newbie is there any better way of doing it than the following .

        (havent tried it on the webspace yet but assume it works just as well)

        <?php

        $junk=getcwd();
        print $junk;

        $pass="0"; $long=0;

        $tv=strlen($jun k); $dvd=$tv-1;

        while ($pass=="0")
        {
        $vhs=substr($ju nk,$dvd,1);
        if ($vhs==chr(47)) {$pass=1;}
        if ($vhs==chr(92)) {$pass=1;}
        $long=$long+1; $dvd=$dvd-1;
        }

        $vhs=substr($ju nk,$dvd+2,$long-1);
        print "<br><br>";
        print "$vhs";

        ?>

        Comment

        • Janwillem Borleffs

          #5
          Re: Find the name of the current folder

          Krustov wrote:[color=blue]
          > As I only need/want the last folder name and as i'm still a bit of a
          > php newbie is there any better way of doing it than the following .
          >[/color]

          print basename(getcwd ());


          JW


          Comment

          • Krustov

            #6
            Re: Find the name of the current folder

            <comp.lang.ph p , Janwillem Borleffs , jw@jwscripts.co m>
            <4373b613$0$675 71$dbd4d001@new s.euronet.nl>
            <Thu, 10 Nov 2005 22:05:28 +0100>
            [color=blue][color=green]
            > > As I only need/want the last folder name and as i'm still a bit of a
            > > php newbie is there any better way of doing it than the following .
            > >[/color]
            >
            > print basename(getcwd ());
            >[/color]

            Typical and my own fault for not being clear in the OP .

            Comment

            Working...