|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
linking a .css file to a php script
Hello everyone.
I want to link a .css file to my php script. I tried ti include the .cc file but it gave me an error about include_path. I made sure the pathname was correct and it didn't work. Does anyone have any ideas? |
|
#2
|
|||
|
|||
|
you don't include it with the include() function. you include it just as you would in HTML (between the HEAD tags):
Code:
<link rel="stylesheet" type="text/css" href="styles.css" /> (or whatever the name of your file is) |
|
#3
|
|||
|
|||
|
You can also place the <link> element in another file and include that file.
For example, you can write a "header.inc" file like this: <html> <head> <title>My Stuff</title> <link rel="stylesheet" href="style.css" type="text/css"> </head> and then include the header.inc file in your php file like this <?php include("header.inc"); include("otherfiles.inc"); ?> |
|
#4
|
|||
|
|||
|
Stylesheets can grow with your site and become pretty complex as different formatting requirements come up. I think it's a good idea to use them with include -- just make sure your include_path is adjusted in php.ini.
Windows: include_path=".;c:\Webshare\Wwwroot\php\" Point it to the directory where you want to keep your .inc files and the stylesheet will work.
__________________
I'm not impatient, I just have a low tolerance for boredom. |
|
#5
|
|||
|
|||
|
mbritton72 has the answer to the question your asking.
If you run a phpinfo.php page, you will be able to find out what is set as the current include_path for your php setup. All you have to do then, is put your .css include file in that folder and it should work fine. |
![]() |
| Viewing: Dev Shed Forums > Web Design > CSS Help > linking a .css file to a php script |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|