Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End PHP; howto use absolute paths Re: PHP; howto use absolute paths

#71839
quelake
Member

Well, as soon as I got home I’ve been fiddling with the settings a bit more, and…

I think I got it?

At first I used a construction such as below, and used $root_nl to link to the root-folder (I found this method for absolute paths in a tutorial). This did not work well in my case.

<?php
$root_nl = realpath($_SERVER["DOCUMENT_ROOT"]);
?>

It turned out to be much simpler I gues…Am I right in assuming that any file that is referenced to beginning with a "/" is approached from the root directory, while any file that is in the form of, for example "images/some/file.php" is a relative path, depending on the current directory?

I have put up some files on a temp site; you can go here if you’re interested in seeing what I’ve made of it.

http://www.dualiciouz.com/temp/index.php
http://www.dualiciouz.com/temp/nl/indexnl.php
http://www.dualiciouz.com/temp/includes/header_nl.php
http://www.dualiciouz.com/temp/includes/header_en.php

(that are undoubtedly some typo’s in there, but bare with me) I have uploaded the bare essentials; CSS file and just one image to see if the link is correct. So if you’re thinking the site looks incredibly ugly; you’re right! ;)