timmy2 Posted August 7, 2007 Share Posted August 7, 2007 Is there a way I can have php in css? Quote Link to comment https://forums.phpfreaks.com/topic/63757-php-in-css/ Share on other sites More sharing options...
GingerRobot Posted August 7, 2007 Share Posted August 7, 2007 What exactly do you mean? PHP can echo out your css. Quote Link to comment https://forums.phpfreaks.com/topic/63757-php-in-css/#findComment-317726 Share on other sites More sharing options...
Psycho Posted August 7, 2007 Share Posted August 7, 2007 I suppose you could set up the server to process CSS files as PHP. But, when referencing a css file to be inlcuded, you can just reference a PHP file instead of a CSS file and have the PHP output the data for the CSS. Quote Link to comment https://forums.phpfreaks.com/topic/63757-php-in-css/#findComment-317729 Share on other sites More sharing options...
The Little Guy Posted August 7, 2007 Share Posted August 7, 2007 If you want to PHP/CSS, you need to place the css in the PHP file, in the head of the document using the: <stye type="text/css"> and </style> tags. Quote Link to comment https://forums.phpfreaks.com/topic/63757-php-in-css/#findComment-317731 Share on other sites More sharing options...
frost Posted August 8, 2007 Share Posted August 8, 2007 I have done this before, you can set it up like: <stye type="text/css"> body { background-color:<? echo "$bodycolor" ?>; } </style> Quote Link to comment https://forums.phpfreaks.com/topic/63757-php-in-css/#findComment-318697 Share on other sites More sharing options...
tarun Posted August 8, 2007 Share Posted August 8, 2007 Why Not Just Do Something Similar To This <?php header('Content-type: text/css'); echo "body { margin: 0; }"; ?> ThanX, Tarun Quote Link to comment https://forums.phpfreaks.com/topic/63757-php-in-css/#findComment-318794 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.