Re: Question about time...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At 3:13 PM +0200 10/25/07, Zoltán Németh wrote:
2007. 10. 25, csütörtök keltezéssel 09.01-kor Jason Pruim ezt írta:
> That's actually where I got the idea, just couldn't remember who on
what list said they did it :) using variables in css is it as easy as just putting in a quick <?PHP echo "background: $date"; ?> in the css? or is it more complicated?

you have to configure apache to handle css files as php files.
also you have to send headers including content-type set to text/css

and then you can script your css

greets
Zoltán Németh

That's one way.

Here's another:

http://sperling.com/examples/pcss/

As Zoltán suggested, but didn't elaborate, you can drop a .htaccess file into your root directory that contains:

<FilesMatch "\.(css|style)$">
 SetHandler application/x-httpd-php
</FilesMatch>

and then use <?php whatever you want ?> inside the css file.

This makes things easier when trying to change constants like colors, or dealing with the box-model problem, or rules that are dependant upon other rules; or really neat automatic image width/height determinations for images on the fly (think about that). :-)

There are a lot of opportunities to add functionality to css that apparently has not been addressed in any documentation I've been able to find. I can't be the first down this street, but for certain it hasn't been traveled often.

Cheers,

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux