config.php help

Associate
Joined
18 Oct 2002
Posts
1,581
Location
Nottingham
I am in the middle of creating a website with a config.php so that it can be uploaded and changed quickly, the only problem seems to be if the site is uploaded to a folder that isnt the root folder.

I have been using things like server document root commands and things all the way through. I came up with the genius idea of putting in the config the ability to set a folder name if it is uploaded in the folder the only problem is that you cant include the config with out knowing the folder....which is held in the config.

If this makes any sense to you then I am impressed. Basically i need a way of no matter how it is hosted root or not being able to include the config. I dont want to have to include lots of the same code on each page to check this when i can define it in the config. It is just the initial getting to the config.

Any ideas or are you just totally confused!! :confused:
 
this would work for all pages in the top directory of the site.

but if i was in

/otherfolder/example.php

i would have to include the config with '../'

i am looking for a way to have it the same on every page no matter which folder you are in.

EDIT: is there a way of catching the error so that if it cant find the config file i can then tell it to look one directory above. so:

if ( look for config in 'config/config.php' = error)
{
look for config in '../config/config.php'
}
 
Last edited:
Back
Top Bottom