Embed PHP in CSS
So, over the weekend I signed up to Twitter.com!
I'm normally very behind when it comes to online trends such as MySpace, Facebook, Digg.com etc.
I normally wait until I get so many invites each day that I just give in to peer pressure!
As a budding internet marketer I like to try anything that can promote my material.
Anyway onto today's blog: I found out something really useful over the weekend.
You can embed PHP into CSS documents.
Why?
To create dynamic and interactive style sheets.
For example: the colour of your website could change whether it's daytime or nighttime. The background of the website could change when it's raining, the possibilities are endless
It's pretty simple to do; just create/edit your .htaccess file in the root of your site and place the following in it:
AddHandler application/x-httpd-php .css
This will set PHP to handle all files with the .css extension, so you can add PHP code within your style sheets.
Have some fun with interactive style sheets!
See you tomorrow at 09:00
Simon

Kline (2 Comments)
Monday, January 25, 2010 12:42 PM