Forum Moderators: coopster

Message Too Old, No Replies

doc_root and user_dir

         

supermanjnk

7:04 am on Nov 26, 2004 (gmt 0)

10+ Year Member



I was recently looking through the bag of tricks and I found this for includes

<?
ini_set('include_path', realpath($_SERVER['DOCUMENT_ROOT'] . '/b_site/include/') . '.' . PATH_SEPARATOR . ini_get('include_path'));
?>

what i was wondering is can i set the doc_root and user_dir the same way, and if i do will this allow me to link images by typing in src="images/file.gif" and have it point to www.widgets.com/images/file.gif?

if so would this be the correct code for it

<?
ini_set('user_dir', realpath($_SERVER['DOCUMENT_ROOT'] . '/b_site/') . '.' . PATH_SEPARATOR . ini_get('user_dir'));
?>

<?
ini_set('doc_root', realpath($_SERVER['DOCUMENT_ROOT'] . '/b_site/') . '.' . PATH_SEPARATOR . ini_get('doc_root'));
?>

basically i need a way to make it so that the images for my menu show on every page without having to put them in every sub directory...

Salsa

1:32 am on Nov 27, 2004 (gmt 0)

10+ Year Member



If I'm understanding you correctly, won't it work for you to simply put a / before images/file.gif to make the path relative to your document root? Like:

/images/file.gif

No PHP needed.