Re: [PHP] neubie seeking answers

2011-04-01 Thread Richard Quadling
On 1 April 2011 03:31, Kirk Bailey  wrote:
> PERFECT SIMPLE SOLUTION. THANK YOU!
>
> On 3/31/2011 12:34 PM, Stuart Dallas wrote:
>>
>> On Thursday, 31 March 2011 at 17:24, Kirk Bailey wrote:
>> I need to extract the name of the subdirectory a page lives in to
>>>
>>> use in the title for that page. This will be returned as a string to
>>> echo to the output stream. Now how the heck do I do that?!?
>>
>> $dir = basename(dirname(__FILE__));
>>
>> -Stuart

Are my posts invisible?



-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] neubie seeking answers

2011-04-01 Thread Stuart Dallas
On Friday, 1 April 2011 at 03:31, Kirk Bailey wrote:
PERFECT SIMPLE SOLUTION. THANK YOU!

As Richard noted there is a constant called __DIR__ which is equivalent to 
dirname(__FILE__) so basename(__DIR__) will give you what you want and saves a 
few cycles.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/


> On 3/31/2011 12:34 PM, Stuart Dallas wrote:
> > On Thursday, 31 March 2011 at 17:24, Kirk Bailey wrote:
> > I need to extract the name of the subdirectory a page lives in to
> > > use in the title for that page. This will be returned as a string to
> > > echo to the output stream. Now how the heck do I do that?!?
> > $dir = basename(dirname(__FILE__));
> > 
> > -Stuart
> 
> -- 
> end
> 
> Very Truly yours,
>  - Kirk Bailey,
>  Largo Florida
> 
>  kniht
>  +-+
>  | BOX |
>  +-+
>  think
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] neubie seeking answers

2011-03-31 Thread Kirk Bailey

PERFECT SIMPLE SOLUTION. THANK YOU!

On 3/31/2011 12:34 PM, Stuart Dallas wrote:

On Thursday, 31 March 2011 at 17:24, Kirk Bailey wrote:
I need to extract the name of the subdirectory a page lives in to

use in the title for that page. This will be returned as a string to
echo to the output stream. Now how the heck do I do that?!?

$dir = basename(dirname(__FILE__));

-Stuart



--
end

Very Truly yours,
 - Kirk Bailey,
   Largo Florida

   kniht
  +-+
  | BOX |
  +-+
   think


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] neubie seeking answers

2011-03-31 Thread Steve Staples
On Thu, 2011-03-31 at 17:34 +0100, Stuart Dallas wrote:
> On Thursday, 31 March 2011 at 17:24, Kirk Bailey wrote:
> I need to extract the name of the subdirectory a page lives in to 
> > use in the title for that page. This will be returned as a string to 
> > echo to the output stream. Now how the heck do I do that?!?
> 
> $dir = basename(dirname(__FILE__));
> 
> -Stuart
> 
> -- 
> Stuart Dallas
> 3ft9 Ltd
> http://3ft9.com/

That is what I was thinking... but for some reason, I couldn't remember
it... so I did that whole explode() thing... oh well! Kirk, use that :)


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] neubie seeking answers

2011-03-31 Thread Steve Staples
On Thu, 2011-03-31 at 12:24 -0400, Kirk Bailey wrote:
> I need to extract the name of the subdirectory a page lives in to 
> use in the title for that page. This will be returned as a string to 
> echo to the output stream. Now how the heck do I do that?!?
> 
> -- 
> end
> 
> Very Truly yours,
>   - Kirk Bailey,
> Largo Florida
> 
> kniht
>+-+
>| BOX |
>+-+
> think
> 
> 

I am SURE that there is a better reply already... but quick and dirty...




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] neubie seeking answers

2011-03-31 Thread Stuart Dallas
On Thursday, 31 March 2011 at 17:24, Kirk Bailey wrote:
I need to extract the name of the subdirectory a page lives in to 
> use in the title for that page. This will be returned as a string to 
> echo to the output stream. Now how the heck do I do that?!?

$dir = basename(dirname(__FILE__));

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] neubie seeking answers

2011-03-31 Thread Richard Quadling
On 31 March 2011 17:24, Kirk Bailey  wrote:
> I need to extract the name of the subdirectory a page lives in to use in the
> title for that page. This will be returned as a string to echo to the output
> stream. Now how the heck do I do that?!?

__DIR__ is the name of the directory that the __FILE__ resides in.

basename(__DIR__) will give you the directory at the end of the path
that this __FILE__ is in.

So, for ...

C:\PHP\Scripts\script.php



will show

C:\PHP\Scripts\script.php
C:\PHP\Scripts
Scripts




-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php