hi guys, i've been trying to get a work around for this:
in a file structure like this:

-----index.php (file inside root)
-----template (folder inside root)
-----user (folder inside root)
-----products (folder inside root)
-----config (folder inside root)

i've been tryoing to use dirname(dirname(FILE)) inside a file in the config folder to define webroot constant but it is not working well, if i try to access the files from other folders, it's calling webroot from the current folder instead of going back to the root.
pls can any1 help me with the code/logic for defining web root in a situation like this. thanks.

6 Years
Discussion Span
Last Post by diafol

yeah, i could, but i woludn't know d path on my host's server, & when i tried using $_SERVER['DOCUMENT_ROOT'], it's calling the constant from the users folder, instead of from the root.

include($_SERVER['DOCUMENT_ROOT'] . '/template/somefile.tpl');

this should work whether you're in the root or the users folder or whether the above lies in a include file itself. You may want to define a constant for the docroot through and use that instead.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.