| 
 Posted by Jerry Stuckle on 05/08/06 15:11 
TristaSD wrote: 
> I'm trying to point to an include file from php like so: 
>  
> <?php require('/main/includes/nav_stripe.php');?> 
>  
> That approach is perfectly fine when trying to point to a folder 
> INCLUDES inside folder MAIN on the root IN HTML.  However, php is 
> producing errors. 
>  
> Is there a solid safe way to reference a file/folder regardless of how 
> many levels up or down it is? 
>  
 
When you use absolute filenames, PHP references it to the OS's file system root,  
not the root directory of your website.  So unless you have a file on your  
computer called 
 
  /main/includes/nav_stripe.php 
 
this will fail. 
 
If you want to be relative to your website's root directory, you need to use: 
 
   <?php require($_SERVER['DOCUMENT_ROOT'] . '/main/includes/nav_stripe.php'); ?> 
 
or something similar. 
 
--  
================== 
Remove the "x" from my email address 
Jerry Stuckle 
JDS Computer Training Corp. 
jstucklex@attglobal.net 
==================
 
[Back to original message] 
 |