|
Posted by Jerry Stuckle on 11/21/43 11:36
John K wrote:
> In ASP/IIS if I want to point to a folder/directory in the root as an
> in include I write this...
>
> <!--#include virtual="/menu.asp" -->
>
> In PHP/Apache I have to do this...
> <?php include "menu.php" ?> or something like this....
>
> My problem is in asp I can reference this file from any
> folder/directory. For example, if I were here.... "/admin/default.asp"
> I could reference the include as is. In php I can't do this, at least
> I don't know how to. Another problem is that if there are file paths
> in the include itself this problem comes up again. I know I could
> write this <?php include "../menu.php"?> and it would find it's way to
> the file but what about the file paths in the include? This is a menu
> with relative paths to images.
>
> How can I point at a file in the root from any directory in my website
> using a relative path? I know I should probably avoid an http://
> reference.
>
> Thanks!!
>
Check out $_SERVER['DOCUMENT_ROOT']. It always points to the root
directory of your web site, no matter where that is.
You could, for instance, do something like:
<?php include($_SERVER['DOCUMENT_ROOT'] . '/include/menu.php'); ?>
or similar.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|