base url - not sure what im looking for, what i DO find doesnt seem to help

Hi all,

im sure sombody might have come across this topic before but i dont know what to look for to get the right answer,

i have spent days googling it and some of the examples just dont seem to help, so i wonder if anybody on here might be able to help me… please :smiley:

its probably quite simple to every body else lol!

i am a noobie and having a go with php and building a site …
I have several directories with php scripts within on various directory levels, this so i can use htacces to block direcy listing etc.

i am using a linux server

My problem that i am having is that i want to be set links and include starting from the a base url each time that way i dont have worry about “…/” etc becase when i do the include seem to have a mind of their own

i have tried …

$base = $_SERVER[“DOCUMENT_ROOT”]
$_SESSION[‘base’] = $base . “info/”
and doing things link … <? include $_SESSION['base'] . "info.php"; ?>

but being on a shared hosting account i just end up getting eg “shared/account/html” followed by the $_SERVER[‘document_root’] again

i jus cant seem to find a way to set $_SESSION[‘base’] to always start me off from the same point and then add where i want it to go so no matter where i am in the scripting i can always be assured that it start from the base etc.

does anybody know what i mean and what i can find out to get my answer

many thanks in advance

hi sorry i havnt seen that before and i dont know what it means or where to use it, sorry to sound like a thickie :-[

Can you use the code and php buttons for you post as this will help people to see your code properly

but being on a shared hosting account i just end up getting eg "shared/account/html" followed by the again

so you get this as your root path ?
[php]“shared/account/html”$_SERVER[‘document_root’][/php]
maybe you should just define it yourself

[php]define(PHP_ROOT, “/path to my/include folder/”)[/php]

Or try
[php]auto_prepend_file[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service