Ross wrote: > I have lots of folders and files some are in the main public_html folder and > some are in their own foder. I need to find a way to make all the links > relative to the public_html folder > > For example if I am in the 'gallery' folder, the main index file is located > at ../index, however if I om in the contact page which is in the same > directory as index the link is just index.php. > > I want to have one menu and make all the links work without having to enter > a full http://www.mydomain/myfolder/myfile.php. > > I tried $_SERVER['doc_root']; but this gives the full server root. I am sure > I have see a way to define directorries using define() or something. // think about these 3 imaginary paths: $docroot = '/var/www/public'; $galleryfile = '/var/www/public/gallery/index.html'; $baseurl = 'http://bla.com'; // imagine you do something *like* (str_replace() is possibly not the right choice here) this: echo '<a href=",$baseurl,str_replace($docroot,'',$galleryfile),">your link</a>'; /* now you only have to figure out how to get a complete list of files that exist in your webroot (you'll probably also need to figure out how to get a relevant text for each link but that's another story), read these pages, including the user notes: http://php.net/glob http://php.net/scandir http://php.net/filesystem http://php.net/dir */ > > Ta. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php