Re: variables in CSS in PHP question/problems

From: Date: Wed, 14 Mar 2007 17:29:41 +0000
Subject: Re: variables in CSS in PHP question/problems
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-250600@lists.php.net to get a copy of this message
At 2:15 AM -0500 3/14/07, Richard Lynch wrote:
Surf directly to your CSS URL and see what happens. There are several possibiliies: #1. Your CSS has <?php ... ?> in its output, because you have not convinced your web-server to run your CSS file through PHP to compute the dynamic result. You need something like this in .htacces: <File whatever.css> ForceType application/x-httpd-php </File> whatever.css should be your CSS filename.
To all: In addition to what Richard said: I came into this conversation late, so please forgive me if I'm not on track, but if one is trying to use php variables in css, you might want to place this at the top of your css files: <?php header('Content-Type: text/css; charset=UTF-8'); ?> and then add this to your .htacces file: <FilesMatch "\.(htm|html|css|tpl)$"> SetHandler application/x-httpd-php </FilesMatch> After that, you can set variables within your css files by <?php echo(<whatever>) ?> hth's tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com

« previous php.general (#250600) next »