pellio Posted November 10, 2008 Share Posted November 10, 2008 hi iv written a css file defining colours as variables then output it as php,brought it into another page and tried to apply the style but it doesnt seem to work.any ideas??im a referencing the class wrongly in the receiving page??cheers here is the css page called phpcolour.php: <?php header("Content-type: text/css"); $blue = '#0000FF'; $black = '#000000'; $red = '#FF0000'; ?> .text { color:<?=$blue?>; } .text2 { color:<?=$red?>; } .text3 { color:<?=$black?>; } receiving page code: <html> <head> <title>Formatting Output</title> <link rel="stylesheet" media="screen" type="text/css" href="phpcolor.php"> </head> <body> <p class="text3"> dghghfgdhf ghdgfhdgfhj gdhjfghjdgfhjd sgfhgdshfhjdgf hjdgfhjgdfhjgdhfghjdsfg ghgdshjf ghghjg gsfhjgdhj ghghg gjhghjg ggggggg ggggggggggggghjgh jghjfghdjsgfhjds ghfjgdhfgh dsgfhdsghfgdhf ghdgfhdshfgdhsg jhjghfghfhgjfh ghfjghdfjghfj dhgjfdhgjdfjghjdfh gjhfdjhgjdfhj ghfdjghfdjghfdgh fdhjghfjhgfhd jhgfdhhgjfhgkfhgj fdhgjfjgfgjgh jfhgfjhgjfdh gjfdhgjfhgjfd hgjfhdkghkdfgfhg fjhjghjfhjgh dfjhgjfdhgg </p> </body> </html> Link to comment https://forums.phpfreaks.com/topic/132187-outputting-php-as-css-and-applying-the-css-to-receiving-page/ Share on other sites More sharing options...
rhodesa Posted November 10, 2008 Share Posted November 10, 2008 the code works fine...what are you expecting to happen, and what is actually happening for you? Link to comment https://forums.phpfreaks.com/topic/132187-outputting-php-as-css-and-applying-the-css-to-receiving-page/#findComment-687028 Share on other sites More sharing options...
pellio Posted November 10, 2008 Author Share Posted November 10, 2008 sorry my fault i made the .text3 class black by accident instead of another color so i thought it was not applyin the class.sorry for wasting your time Link to comment https://forums.phpfreaks.com/topic/132187-outputting-php-as-css-and-applying-the-css-to-receiving-page/#findComment-687036 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.