CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignCSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 14th, 2003, 12:30 PM
simonmaduro's Avatar
simonmaduro simonmaduro is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: USA
Posts: 140 simonmaduro User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 h 5 m 4 sec
Reputation Power: 6
Send a message via Yahoo to simonmaduro
OO CSS? Creating single CSS file and including with php on many pages

I have a single CSS file that I'm using all over the place on my website. When I edit the file, I have to copy it to each directory to make sure that each directory is using the same file.

I would like to have a php file in each directory that I can include with the same code in every file, that points to the CSS file in the root directory of the site.

I tried putting this in the html of the page:

Code:

<?php include('styleref.php'); ?>


Then put this in styleref.php:

PHP Code:
<link rel="stylesheet" type="text/css" href="http://www.website.com/layout.css"


But this didn't work.

Any hints?

Reply With Quote
  #2  
Old October 14th, 2003, 01:37 PM
jharnois's Avatar
jharnois jharnois is offline
mod_dev_shed
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Sep 2002
Location: Atlanta, GA
Posts: 14,288 jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 2 Days 1 h 10 m 39 sec
Reputation Power: 744
No need to have PHP do anything. Put your layout.css file in the document root and use the following:
Code:
<link rel="stylesheet" type="text/css" href="/layout.css" />
B/c you precede layout.css with a forward slash in the href attribute, it will look for that file relative to the document root instead of relative to the current directory, which is where it looks if you don't preced the filename with a forward slash.
__________________
# Jeremy

Explain your problem instead of asking how to do what you decided was the solution.

Reply With Quote
  #3  
Old October 14th, 2003, 02:02 PM
simonmaduro's Avatar
simonmaduro simonmaduro is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: USA
Posts: 140 simonmaduro User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 h 5 m 4 sec
Reputation Power: 6
Send a message via Yahoo to simonmaduro
What would be considered the root of a website? The directory containing the files displayed when you go to "website.com"?

Reply With Quote
  #4  
Old October 14th, 2003, 02:05 PM
simonmaduro's Avatar
simonmaduro simonmaduro is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: USA
Posts: 140 simonmaduro User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 h 5 m 4 sec
Reputation Power: 6
Send a message via Yahoo to simonmaduro
Figured out the root. Appears it is the "htdocs" folder when running Apache.

Thanks Jeremy.

Reply With Quote
  #5  
Old October 14th, 2003, 02:11 PM
jharnois's Avatar
jharnois jharnois is offline
mod_dev_shed
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Sep 2002
Location: Atlanta, GA
Posts: 14,288 jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 2 Days 1 h 10 m 39 sec
Reputation Power: 744
Quote:
What would be considered the root of a website? The directory containing the files displayed when you go to "website.com"?
Yes, but ...
Quote:
Appears it is the "htdocs" folder when running Apache.
... isn't always the case.

But for now, do what's working.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignCSS Help > OO CSS? Creating single CSS file and including with php on many pages


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway