PHP variable inside CSS file

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
roice
Forum Commoner
Posts: 35
Joined: Tue Mar 02, 2010 9:14 am

PHP variable inside CSS file

Post by roice »

Hello,
Is it possible to put PHP variable inside CSS file (style.css)?
If I'll change the style.css name to style.php, will the browser be able to read it as a style file?

Thank you in advance,
Roi
Griven
Forum Contributor
Posts: 165
Joined: Sat May 09, 2009 8:23 pm

Re: PHP variable inside CSS file

Post by Griven »

Sorta.

Take a look at this tutorial: http://net.tutsplus.com/tutorials/php/s ... -the-hood/
joppe
Forum Newbie
Posts: 7
Joined: Tue Mar 09, 2010 3:18 am

Re: PHP variable inside CSS file

Post by joppe »

or you could have the style in the html (included from another file) and have all the php you want to form that

<head>
<style>
<?php include("style.php"); ?>
</style>
</head>
<body>
...
roice
Forum Commoner
Posts: 35
Joined: Tue Mar 02, 2010 9:14 am

Re: PHP variable inside CSS file

Post by roice »

Thank you both!
Post Reply