| Welcome to WebmasterWorld Guest from 18.104.22.168 |
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
|Become a Pro Member|
|Include file in folder above root folder - how?|
I have a .php script in a folder one level above my website root, and I'd like to include it in pages in various website subfolders, some below the root.
How can I do this? Can I use ($_SERVER['DOCUMENT_ROOT'] in the path in some way? Advice would be appreciated.
Use the actual server directory path.
[edited by: SixTimesEight at 1:11 pm (utc) on Aug. 14, 2007]
|Can I use ($_SERVER['DOCUMENT_ROOT'] in the path in some way? |
I don't know how that can be done, but it is interesting to find out.
How about just going one step up from the root "../folderabove".
Apologies if this is offtopic but I want to know
a CSS stored in this folder, would it be ok with search engines?
Yes, actual server directory path - that worked. Many thanks.
I can't use '../folderabove' because the .php include exists at various folder levels on the site, so the path has to be absolute.
[edited by: Patrick_Taylor at 1:26 pm (utc) on Aug. 14, 2007]
<edit>Your edit answered my question </edit>
[edited by: Habtom at 1:25 pm (utc) on Aug. 14, 2007]
There is a tip on how to accomplish this very task in our PHP Forum Library [webmasterworld.com] in the thread titled Good PHP solutions to small problems [webmasterworld.com] (very last message in the thread).
All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved