...

View Full Version : referencing root directories



AshleyQuick
01-24-2004, 08:12 AM
I've moved some php files to various sub-directories and now the includes aren't displaying. (ie. I've moved http://xyz.net/company.php to http://xyz.net/company/index.php)

Using "/" allows images, js files, etc to show, but php includes will not. I'm sure there is an easy fix and I think I may have seen it before, but I've reached an impasse.

This doesn't work:

<?php include("/includes/inc.nav.php"); ?>

This does

<img src="/art/spacer.gif">

Ashley

sweenster
01-27-2004, 01:53 PM
dead easy - get rid of the initial / when including with php

<?php include("includes/inc.nav.php"); ?>

;)

brothercake
01-28-2004, 01:45 AM
Root paths do work, but your server root is almost certainly not the same as your domain root - it might be "/home/webs/clients/xyz/public_html" or something.

You can do this instead:


<?php include($_SERVER["DOCUMENT_ROOT"] . "/includes/nav.inc"); ?>

AshleyQuick
01-28-2004, 05:38 AM
You can do this instead:


<?php include($_SERVER["DOCUMENT_ROOT"] . "/includes/nav.inc"); ?>
[/B]


This doesn't work. :(

mordred
01-28-2004, 09:23 AM
brothercake used a different file name than you did in his example. You had "inc.nav.php", and brothercake had "nav.inc". Perhaps it is as simple as that... ever check the obvious.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum