needing a dynamic link to an include directory

I am looking at a site where I have a virtual directory and sever sub-directories of varying depth. How do I find the root of the virtual directory for includes like css files? Asked another way, what php do I need do to link to the css file in the include directory regardless if im in the root “index.php” file or some random file in a place like “folder01.03.02”?

[font=courier]/ (~virtual root)
|-folder01
|–folder01.01
|–folder01.02
|–folder01.03
|—folder01.03.01
|—folder01.03.02
|-folder02
|-folder03
|-include
index.php[/font]

Thanks in advance ::slight_smile:

You can do with relative path “/”, it’s means the proyect root directory.

you can use /folder01.03.02/XXXX.css

but if you know what’s the current directory, you can include withou this, “…/…/folder01.03.02/XXXX.css”

Perhaps I was not clear in my question. I am looking for a PHP command/tag that will identify the root of a virtual directory so that I do not need to hard code the path to the css file.
font=courier;[/font]
finds the root if the actual server. This is help ful if you want to link to a file in a known sub directory e.g.
[font=courier]$path_to_css_file = ($_SERVER[‘DOCUMENT_ROOT’]) . “/include/my_style.css”;[/font]
This will not work if you have a virtual directory. It is possible to do a regex from [font=courier]GETCWD()[/font] if you wand to to parse the resulting string… that is cumbersome however.
I guess my real question is, is there an equivalent to font=courier[/font]?

I hope my question makes more sense. Thanks

Sponsor our Newsletter | Privacy Policy | Terms of Service