[thelist] PHP -Self-finding navigational includes

Jens Brueckmann jens.brueckmann at gmail.com
Thu Jul 28 09:15:59 CDT 2005


2005/7/28, Fred D Yocum <fdy at mcc.org>:
>
> [...]need  a function/routine that figures out where the page (with the
> included navigational side bar) is within the directory structure and
> writes the paths accordingly.[...]
> Can anyone point me in the direction of an efficient way of doing this?

Hi Fred,

I use a tiny include consisting of the following code snippet, sitting
in every directory:

  $subsCount = substr_count($_SERVER["PHP_SELF"],"/") - 1;
  $i = 0;
    while ($i++ < $subsCount) { $ROOT .= "../"; }

  unset($i);
  unset($subsCount);


Cheers,

jens
-- 
Jens Brueckmann
http://www.yalf.de
http://www.j-a-b.net


More information about the thelist mailing list