[development] Getting absolute directory path

Khalid Baheyeldin kb at 2bits.com
Wed Mar 14 14:08:54 UTC 2007


See http://www.php.net/realpath

*realpath()* expands all symbolic links and resolves references to '/./',
'/../' and extra '/' characters in the input *path* and return the
canonicalized absolute pathname. The resulting path will have no symbolic
link, '/./' or '/../' components.

On 3/14/07, Darren Oh <darrenoh at sidepotsinternational.com> wrote:
>
> Some users keep contributed modules outside the Drupal directory and
> create symlinks to them in sites/all/modules. This causes problems
> for Chat Room, which uses a PHP file in its own directory for AJAX
> updates (to avoid loading all of Drupal on each update) but must
> include some files from Drupal. I was using the following code to
> find the Drupal files:
>
>      $chatroom_base = urldecode($_POST['chatroom_base']);
>      $depth = substr_count($chatroom_base, '/');
>      chdir(str_repeat('../', $depth+1));
>
> If people are keeping Chat Room outside of Drupal, chdir() will need
> the absolute path to the Drupal directory. What is the best way to
> get this?
>



-- 
2bits.com
http://2bits.com
Drupal development, customization and consulting.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20070314/7ccb0877/attachment.htm 


More information about the development mailing list