CSS sheet in PHP?
Posted: Sun Feb 05, 2006 11:31 am
whats the code to link a CSS style sheet to php?
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
<link rel="stylesheet" href="/template/style.css" type="text/css">Code: Select all
echo '<link rel="stylesheet" href="/template/style.css" type="text/css">';Code: Select all
?><link rel="stylesheet" href="/template/style.css" type="text/css"><?jcart would have demonstrated the power of the PHP to use dynamic CSS dependent on conditions...highonsnow wrote:You could also shave off a little overhead by avoiding the echo and simply doing this:
Since PHP has no business with that string, why send it through the parserCode: Select all
?><link rel="stylesheet" href="/template/style.css" type="text/css"><?
Code: Select all
?><link rel="stylesheet" href="/template/<?echo $vars_template_name;?>/style.css" type="text/css"><?Code: Select all
<link rel="stylesheet" type="text/css" href="somescript.php?page=prices" />Code: Select all
<?php header('Content-type: text/css'); ?>
body {
margin: 0;
padding: 5px 20px;
background-color: <?php
switch ($_GET['page'])
{
case 'prices' :
echo '#EEEEEE;';
break;
default:
echo '#FFFFFF;';
}
?>
}
div#foo {
border: 1px dotted #AAAAAA;
}
/* etc etc etc */Code: Select all
<link rel="stylesheet" href="/skin/ice_blue/index.css" type="text/css">Code: Select all
body{
margin-top:5px;
background-image:url(images/bg.gif);
}
div.banner{
background-image:url(images/1_01.gif);
color:#000000;
margin:auto;
height:100px;
width:700px;
top:0px;
}
div.links{
background-image:url(images/1_02.gif);
color:#000000;
margin:auto;
height:14px;
width:700px;
font-size: 9px;
font-family: Verdana, Arial, Helvetica, sans-serif;
text-align: center;
}
div.content{
background-image:url(images/1_03.gif);
color:#000000;
margin:auto;
height:auto;
width:700px;
font-size: 9px;
font-family: Verdana, Arial, Helvetica, sans-serif;
text-indent:2px;
}
div.end{
background-image:url(images/1_04.gif);
color:#000000;
margin:auto;
height:2px;
width:700px;
}Code: Select all
|ROOT|
index.php
|SKIN|
|IMAGES|
index.cssxEzMikex wrote:.bump
sorry for the bump... uhm the images folder is in the ice_blue folder so i thought i only had to put "/images/<img>" he css file is being imported its just not the pitures i think.d11wtq wrote:The images don't look like they've been referenced correctly.... is the entire CSS file not being imported or is it just the images?
href="/skin/ice_blue/index.css"
background-image:url(../images/bg.gif);