Welcome Guest!
Please login
If you do not have an account yet on The Web Squeeze forums, please Register! It’s FREE and there are many benefits:
- Receive Fast Advice
- Learn Programming Languages
- Get Professional Website Reviews
- Quick Troubleshooting Assistance
|
|
Server Root
This is a discussion on Server Root, within the CSS section. This forum and the thread "Server Root" are both part of the Designing Your Website category.
![]() ![]() |
Apr 30 2008, 09:53 AM
Post
#1
|
|
![]() Rapid Squeezer ![]() ![]() ![]() ![]() Group: Advisors Posts: 479 Joined: 14-February 08 From: Stockport Member No.: 75 |
CODE <?php include [b]$_SERVER['DOCUMENT_ROOT'][/b].'/includes/footer.php'; ?> I know you can use this in php code, and the $_SERVER['DOCUMENT_ROOT'] brings the browser to the root and navigates to the file from there. Is there a way to do this in HTML/CSS when including a stylesheet, as this would be very helpful if i have some subfolders on my site etc?? Thanks for ya help Craig -------------------- |
|
|
Apr 30 2008, 10:14 AM
Post
#2
|
|
![]() Co-Founder ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Co-Founders Posts: 2,775 Joined: 13-February 08 From: Squeezin' Member No.: 2 |
Not using PHP ... why don't you just do
CODE body { background: url(/images/something.jpg)....; ....... } the leading slash brings you to the root. -------------------- The Squeeze Store is now OPEN! Come on in and grab something!
a web design portfolio | web non-sense - REDESIGNED! I'm also on: del.icio.us | flickr | virb | facebook | twitter The Web Squeeze is also on: virb | facebook | stumbleupon - JOIN IN! |
|
|
Apr 30 2008, 11:22 AM
Post
#3
|
|
|
Master of the Universe ![]() ![]() ![]() ![]() ![]() ![]() Group: Advisors Posts: 1,157 Joined: 15-February 08 From: London, England Member No.: 141 |
This sounds like you need the BASE TAG!!!
Never used it myself but I came across it a while ago, seems to fit your needs. http://www.w3schools.com/tags/tag_base.asp -------------------- |
|
|
Apr 30 2008, 04:43 PM
Post
#4
|
|
![]() Rapid Squeezer ![]() ![]() ![]() ![]() Group: Advisors Posts: 479 Joined: 14-February 08 From: Stockport Member No.: 75 |
This sounds like you need the BASE TAG!!! Never used it myself but I came across it a while ago, seems to fit your needs. http://www.w3schools.com/tags/tag_base.asp That is exactly what i mean mate As usual excellent and accurate answer -------------------- |
|
|
Apr 30 2008, 08:41 PM
Post
#5
|
|
![]() Squeezing ![]() ![]() ![]() Group: Members Posts: 78 Joined: 5-March 08 From: Melbourne, Australia Member No.: 195 |
Just to make sure I understand this thing properly.
If I was to have a site set up like this root/index.hmtl root/aboutus.html root/news/studentnews.html root/news/industrynews.html Then as long as I put <base href="root/" /> into the header of each page (obviously root/ would be replaced with the actual directory) then on my studentnews.html page instead of linking to the index page with <a href="../index.html"> I could just have <a href="index.html"> However if I was linking to the industrynews.html page instead of <a href="industrynews.html"> I'd have to have <a href="news/industrynews.html"> ? Does this sound right? If this is right I'm very glad I've learnt this it will make it a lot easier to navigate my site whilst working on it! I can actually use subfolders without manually adjusting the navigation for each folder! |
|
|
May 1 2008, 02:30 AM
Post
#6
|
|
![]() Rapid Squeezer ![]() ![]() ![]() ![]() Group: Advisors Posts: 479 Joined: 14-February 08 From: Stockport Member No.: 75 |
Just to make sure I understand this thing properly. If I was to have a site set up like this root/index.hmtl root/aboutus.html root/news/studentnews.html root/news/industrynews.html Then as long as I put <base href="root/" /> into the header of each page (obviously root/ would be replaced with the actual directory) then on my studentnews.html page instead of linking to the index page with <a href="../index.html"> I could just have <a href="index.html"> However if I was linking to the industrynews.html page instead of <a href="industrynews.html"> I'd have to have <a href="news/industrynews.html"> ? Does this sound right? If this is right I'm very glad I've learnt this it will make it a lot easier to navigate my site whilst working on it! I can actually use subfolders without manually adjusting the navigation for each folder! Yeh i think that's it mate, and this is what i needed it for as when ever i used sub folders it messed everything up. -------------------- |
|
|
May 1 2008, 04:06 AM
Post
#7
|
|
|
Master of the Universe ![]() ![]() ![]() ![]() ![]() ![]() Group: Advisors Posts: 1,157 Joined: 15-February 08 From: London, England Member No.: 141 |
Itsumishi I believe that sounds about right.
-------------------- |
|
|
May 1 2008, 06:54 PM
Post
#8
|
|
![]() Squeezing ![]() ![]() ![]() Group: Members Posts: 78 Joined: 5-March 08 From: Melbourne, Australia Member No.: 195 |
Itsumishi I believe that sounds about right. Yep had a bit of a fiddle with this late last night, didn't get a chance to post it up. That's quite a handy little piece of code. I found my site had quickly grown to a quite a large number of pages and it was becoming a little hard to manage. This will surely help! |
|
|
If you found The Web Squeeze to be helpful, please donate so we can keep this site FREE, FRESH, and fortified with Web Design & Development info!
![]() ![]() |
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
Similar Topics
| Topic Title | Replies | Topic Starter | Views | Last Action | |||
|---|---|---|---|---|---|---|---|
![]() |
4 | Monie | 307 | 20th June 2008 - 02:48 AM Last post by: 4lun |
|||
![]() |
4 | Monie | 263 | 23rd April 2008 - 10:58 PM Last post by: Monie |
|||
![]() |
7 | djeyewater | 373 | 2nd May 2008 - 04:07 PM Last post by: djeyewater |
|||
![]() |
10 | Popje | 400 | 2nd May 2008 - 06:10 PM Last post by: Popje |
|||
![]() |
2 | Rakuli | 94 | 23rd May 2008 - 08:34 AM Last post by: rewake |
|||






Apr 30 2008, 09:53 AM









