Jump to content

PHP in CSS?


kyleldi

Recommended Posts

This might be a stupid question- but is it possible to put PHP code into a CSS file and receive proper results?  I use a header image at the top of all my pages (defined in a CSS file), and I'd like to set it up so it changes on certain days.  I know making the image change is possible- but can it be done within a CSS file?  Thanks  ;D

 

kyleldi

Link to comment
https://forums.phpfreaks.com/topic/72013-php-in-css/
Share on other sites

Are there any additional options possibly?  I'm just kinda trying to see what i've got for resources to make this possible.  I've got a series of headers for each holiday, that change on that given day according to the time on my server.  Just a way to keep things unique in my opinion.  Thanks for your input- i'm working on mimicing something similar right now with your idea.

Link to comment
https://forums.phpfreaks.com/topic/72013-php-in-css/#findComment-362805
Share on other sites

yep, that works. but all we've done is pulled out PHP from the main page and put it into an include(). We still haven't resolved the dynamic CSS issue. we still have one file which is going to need to call one of several CSS files unless we add processing to change the CSS dynamically, for instance, we could have this in a file called cssinclude.php:

 

<?
// Determine values for a_font and some_color up here, then output later:

?>
<STYLE>
H1 {
   font-family: <?=$a_font;?>;
   color: <?=$some_color;?>;
}
</STYLE>

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/72013-php-in-css/#findComment-362817
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.