Connecting Tech Pros Worldwide Help | Site Map

Find the name of the current folder

 
LinkBack Thread Tools Search this Thread
  #1  
Old November 10th, 2005, 04:15 PM
Krustov
Guest
 
Posts: n/a
Default Find the name of the current folder

For use in a install.php

What would be the best way to do it .


  #2  
Old November 10th, 2005, 04:55 PM
Kim André Akerĝ
Guest
 
Posts: n/a
Default 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().
http://php.net/getcwd

--
Kim André Akerĝ
- kimandre@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)
  #3  
Old November 10th, 2005, 05:05 PM
Krustov
Guest
 
Posts: n/a
Default Re: Find the name of the current folder

<comp.lang.php , Kim André Akerĝ , kimandre@NOSPAMbetadome.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 .
  #4  
Old November 10th, 2005, 07:55 PM
Krustov
Guest
 
Posts: n/a
Default Re: Find the name of the current folder

<comp.lang.php , Krustov , krusty@krustov.co.uk.INVALID>
<MPG.1ddd991e1a81c0c498a68a@no-cancel.newsreader.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($junk); $dvd=$tv-1;

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

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

?>
  #5  
Old November 10th, 2005, 08:15 PM
Janwillem Borleffs
Guest
 
Posts: n/a
Default 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


  #6  
Old November 10th, 2005, 08:25 PM
Krustov
Guest
 
Posts: n/a
Default Re: Find the name of the current folder

<comp.lang.php , Janwillem Borleffs , jw@jwscripts.com>
<4373b613$0$67571$dbd4d001@news.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 .
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.