<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Parsing PHP in CSS</title>
	<atom:link href="http://www.davidgagne.net/2008/10/01/parsing-php-in-css/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.davidgagne.net/2008/10/01/parsing-php-in-css/</link>
	<description>The personal weblog of David Vincent Gagne</description>
	<lastBuildDate>Tue, 07 Feb 2012 18:06:59 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: birkof</title>
		<link>http://www.davidgagne.net/2008/10/01/parsing-php-in-css/#comment-371702</link>
		<dc:creator>birkof</dc:creator>
		<pubDate>Fri, 13 Aug 2010 09:45:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.davidgagne.net/?p=6985#comment-371702</guid>
		<description>I simply use this syntax:


	php_value auto_prepend_file none
	php_value default_mimetype &quot;text/css&quot;
	SetHandler application/x-httpd-php

</description>
		<content:encoded><![CDATA[<p>I simply use this syntax:</p>
<p>	php_value auto_prepend_file none<br />
	php_value default_mimetype &#8220;text/css&#8221;<br />
	SetHandler application/x-httpd-php</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cigraphics</title>
		<link>http://www.davidgagne.net/2008/10/01/parsing-php-in-css/#comment-369749</link>
		<dc:creator>cigraphics</dc:creator>
		<pubDate>Mon, 27 Jul 2009 09:48:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.davidgagne.net/?p=6985#comment-369749</guid>
		<description>You can trick the browser like this:

Where you load the style.css file put this:

style.css?MODIFIED_TIME</description>
		<content:encoded><![CDATA[<p>You can trick the browser like this:</p>
<p>Where you load the style.css file put this:</p>
<p>style.css?MODIFIED_TIME</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Creig</title>
		<link>http://www.davidgagne.net/2008/10/01/parsing-php-in-css/#comment-369741</link>
		<dc:creator>Creig</dc:creator>
		<pubDate>Sun, 26 Jul 2009 09:19:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.davidgagne.net/?p=6985#comment-369741</guid>
		<description>I&#039;ve found that (at least) FireFox caches stylesheets forever unless a page is specifically refreshed. Thus, changed stylesheets under a fixed name won&#039;t be reloaded. My workaround when changing stylesheets is to give each a different name (i.e. style001.css, style002.css, ...) and set a variable in my config.php file for the most current style sheet.  

I could see doing this php trick when different browsers need different styles. But you could as easily use different style sheets for different browsers and actively set the variable in config.php accordingly. Do that for the part that MUST be different, and use a single common stylesheet for the rest that doesn&#039;t matter which browser is used.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve found that (at least) FireFox caches stylesheets forever unless a page is specifically refreshed. Thus, changed stylesheets under a fixed name won&#8217;t be reloaded. My workaround when changing stylesheets is to give each a different name (i.e. style001.css, style002.css, &#8230;) and set a variable in my config.php file for the most current style sheet.  </p>
<p>I could see doing this php trick when different browsers need different styles. But you could as easily use different style sheets for different browsers and actively set the variable in config.php accordingly. Do that for the part that MUST be different, and use a single common stylesheet for the rest that doesn&#8217;t matter which browser is used.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew</title>
		<link>http://www.davidgagne.net/2008/10/01/parsing-php-in-css/#comment-369288</link>
		<dc:creator>Andrew</dc:creator>
		<pubDate>Mon, 18 May 2009 00:25:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.davidgagne.net/?p=6985#comment-369288</guid>
		<description>I also agree that it is not good to be loading PHP for every style sheet.  If you load one PHP page with two &#039;dynamic&#039; style sheets, that&#039;s 3 PHP calls for every loaded page, for every visitor.  That will add up real quick if/when your website starts to pull traffic.

The best thing to do is leave the stylesheets static.  If you need to add dynamic style information, include it in the actual web page in style tags.

cigraphics is on the right track for re-generating static style sheets when changes are made to the website, but then you have to worry about browsers caching their CSS sheets because they are expected to be static.  I know there are workarounds for that, but why worry about it?  Just include any dynamic content in the main web page.</description>
		<content:encoded><![CDATA[<p>I also agree that it is not good to be loading PHP for every style sheet.  If you load one PHP page with two &#8216;dynamic&#8217; style sheets, that&#8217;s 3 PHP calls for every loaded page, for every visitor.  That will add up real quick if/when your website starts to pull traffic.</p>
<p>The best thing to do is leave the stylesheets static.  If you need to add dynamic style information, include it in the actual web page in style tags.</p>
<p>cigraphics is on the right track for re-generating static style sheets when changes are made to the website, but then you have to worry about browsers caching their CSS sheets because they are expected to be static.  I know there are workarounds for that, but why worry about it?  Just include any dynamic content in the main web page.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cigraphics</title>
		<link>http://www.davidgagne.net/2008/10/01/parsing-php-in-css/#comment-369240</link>
		<dc:creator>cigraphics</dc:creator>
		<pubDate>Wed, 22 Apr 2009 12:52:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.davidgagne.net/?p=6985#comment-369240</guid>
		<description>That is going to stress the server the easy way is this:

&lt;pre&gt;function css() {
	$bg = &quot;red&quot;;
	$color = &quot;green&quot;;
	$txt = &quot;Arial&quot;;
	
	$css = &lt;&lt;&lt;EOF
body {background-color: $bg; font: $color $txt;}
EOF;
	return $css;
}
$x = css();
file_put_contents(&#039;style.css&#039;, $x);
&lt;/pre&gt;
Add it to your administration panel and when you change the values it will rewrite the style.css file and that&#039;s it. You won&#039;t need to call it every time you enter the site. And if you want to change the styles you can make more files like style_blue.css, style_red.css ...etc</description>
		<content:encoded><![CDATA[<p>That is going to stress the server the easy way is this:</p>
<pre>function css() {
	$bg = "red";
	$color = "green";
	$txt = "Arial";

	$css = &lt;&lt;&lt;EOF
body {background-color: $bg; font: $color $txt;}
EOF;
	return $css;
}
$x = css();
file_put_contents('style.css', $x);
</pre>
<p>Add it to your administration panel and when you change the values it will rewrite the style.css file and that&#8217;s it. You won&#8217;t need to call it every time you enter the site. And if you want to change the styles you can make more files like style_blue.css, style_red.css &#8230;etc</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Coderies &#124; taggle.org</title>
		<link>http://www.davidgagne.net/2008/10/01/parsing-php-in-css/#comment-369061</link>
		<dc:creator>Coderies &#124; taggle.org</dc:creator>
		<pubDate>Thu, 26 Mar 2009 08:30:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.davidgagne.net/?p=6985#comment-369061</guid>
		<description>[...] Utiliser du PHP dans vos CSS, un classique utile [...]</description>
		<content:encoded><![CDATA[<p>[...] Utiliser du PHP dans vos CSS, un classique utile [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: yaqoob</title>
		<link>http://www.davidgagne.net/2008/10/01/parsing-php-in-css/#comment-369025</link>
		<dc:creator>yaqoob</dc:creator>
		<pubDate>Fri, 20 Mar 2009 17:07:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.davidgagne.net/?p=6985#comment-369025</guid>
		<description>ah, tags were stripped, I used
FilesMatch &quot;style.css&quot;</description>
		<content:encoded><![CDATA[<p>ah, tags were stripped, I used<br />
FilesMatch &#8220;style.css&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: yaqoob</title>
		<link>http://www.davidgagne.net/2008/10/01/parsing-php-in-css/#comment-369024</link>
		<dc:creator>yaqoob</dc:creator>
		<pubDate>Fri, 20 Mar 2009 17:05:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.davidgagne.net/?p=6985#comment-369024</guid>
		<description>because (as far as I know) if you leave .php extension browser wont be caching it

I found a solution for setting only a specific file to be processed:

&lt;code&gt;

SetHandler application/x-httpd-php

&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>because (as far as I know) if you leave .php extension browser wont be caching it</p>
<p>I found a solution for setting only a specific file to be processed:</p>
<p><code></p>
<p>SetHandler application/x-httpd-php</p>
<p></code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave</title>
		<link>http://www.davidgagne.net/2008/10/01/parsing-php-in-css/#comment-369023</link>
		<dc:creator>Dave</dc:creator>
		<pubDate>Fri, 20 Mar 2009 15:48:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.davidgagne.net/?p=6985#comment-369023</guid>
		<description>Why not just give the CSS file a .php extension?</description>
		<content:encoded><![CDATA[<p>Why not just give the CSS file a .php extension?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Page 2</title>
		<link>http://www.davidgagne.net/2008/10/01/parsing-php-in-css/#comment-369022</link>
		<dc:creator>Page 2</dc:creator>
		<pubDate>Fri, 20 Mar 2009 15:30:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.davidgagne.net/?p=6985#comment-369022</guid>
		<description>[...] Parsing PHP in CSS (tags: php htacces) [...]</description>
		<content:encoded><![CDATA[<p>[...] Parsing PHP in CSS (tags: php htacces) [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: The Blog of Hanas</title>
		<link>http://www.davidgagne.net/2008/10/01/parsing-php-in-css/#comment-369021</link>
		<dc:creator>The Blog of Hanas</dc:creator>
		<pubDate>Fri, 20 Mar 2009 14:08:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.davidgagne.net/?p=6985#comment-369021</guid>
		<description>[...] Parsing PHP in CSS — Tell your website to treat CSS files as if they’re PHP files to make life easier. [...]</description>
		<content:encoded><![CDATA[<p>[...] Parsing PHP in CSS — Tell your website to treat CSS files as if they’re PHP files to make life easier. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Juan</title>
		<link>http://www.davidgagne.net/2008/10/01/parsing-php-in-css/#comment-369020</link>
		<dc:creator>Juan</dc:creator>
		<pubDate>Fri, 20 Mar 2009 14:02:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.davidgagne.net/?p=6985#comment-369020</guid>
		<description>Why should I do this?...</description>
		<content:encoded><![CDATA[<p>Why should I do this?&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: t</title>
		<link>http://www.davidgagne.net/2008/10/01/parsing-php-in-css/#comment-369019</link>
		<dc:creator>t</dc:creator>
		<pubDate>Fri, 20 Mar 2009 13:03:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.davidgagne.net/?p=6985#comment-369019</guid>
		<description>I Do think that you don&#039;t need to declare a new MIME type, as you are already being rcvd as one ( AddHandler application/x-httpd-php .css ) 

You would need the MIME override if it was a .php file.

Cheers,
Anon</description>
		<content:encoded><![CDATA[<p>I Do think that you don&#8217;t need to declare a new MIME type, as you are already being rcvd as one ( AddHandler application/x-httpd-php .css ) </p>
<p>You would need the MIME override if it was a .php file.</p>
<p>Cheers,<br />
Anon</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mar-20-2009 php links &#124; w3feeds</title>
		<link>http://www.davidgagne.net/2008/10/01/parsing-php-in-css/#comment-369018</link>
		<dc:creator>Mar-20-2009 php links &#124; w3feeds</dc:creator>
		<pubDate>Fri, 20 Mar 2009 12:30:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.davidgagne.net/?p=6985#comment-369018</guid>
		<description>[...] Parsing PHP in CSS â?? davidgagne.net [...]</description>
		<content:encoded><![CDATA[<p>[...] Parsing PHP in CSS â?? davidgagne.net [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: murphy42</title>
		<link>http://www.davidgagne.net/2008/10/01/parsing-php-in-css/#comment-369017</link>
		<dc:creator>murphy42</dc:creator>
		<pubDate>Fri, 20 Mar 2009 08:42:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.davidgagne.net/?p=6985#comment-369017</guid>
		<description>In fact there is only one thing you have to do, i always skip step 1 and name my stylesheets that require processing 
mystyle.php and in the beginning i use your header(’Content-type: text/css’); to convince server and browser that the file is really css.

You can then use for example link rel=&quot;stylesheet&quot; href=&quot;mystyle.php&quot;

The browser is not interested in the fileextension, only the server uses them sometimes. And i can  see what is php, there is no need to work with .htaccess and its also a bit more serverfriendly because most css files get delivered directly.  

Matthias</description>
		<content:encoded><![CDATA[<p>In fact there is only one thing you have to do, i always skip step 1 and name my stylesheets that require processing<br />
mystyle.php and in the beginning i use your header(’Content-type: text/css’); to convince server and browser that the file is really css.</p>
<p>You can then use for example link rel=&#8221;stylesheet&#8221; href=&#8221;mystyle.php&#8221;</p>
<p>The browser is not interested in the fileextension, only the server uses them sometimes. And i can  see what is php, there is no need to work with .htaccess and its also a bit more serverfriendly because most css files get delivered directly.  </p>
<p>Matthias</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Henrik Nielsen</title>
		<link>http://www.davidgagne.net/2008/10/01/parsing-php-in-css/#comment-369016</link>
		<dc:creator>Henrik Nielsen</dc:creator>
		<pubDate>Fri, 20 Mar 2009 07:38:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.davidgagne.net/?p=6985#comment-369016</guid>
		<description>Or you could simply make a .php file with the &quot;header&quot; code, and include it in your html as a style-sheet. The browser care about content-type, not file extensions.

Thereby you still have the option of using a static .css file when no php is needed in your style sheets, for better performance.

/henrik</description>
		<content:encoded><![CDATA[<p>Or you could simply make a .php file with the &#8220;header&#8221; code, and include it in your html as a style-sheet. The browser care about content-type, not file extensions.</p>
<p>Thereby you still have the option of using a static .css file when no php is needed in your style sheets, for better performance.</p>
<p>/henrik</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rock</title>
		<link>http://www.davidgagne.net/2008/10/01/parsing-php-in-css/#comment-369015</link>
		<dc:creator>rock</dc:creator>
		<pubDate>Fri, 20 Mar 2009 06:09:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.davidgagne.net/?p=6985#comment-369015</guid>
		<description>...except that serving a PHP page is much more expensive in terms of memory and CPU cycles, also i can&#039;t seriously imagine where you would need generated CSS; i&#039;m sure the output of your elaborate loops could be cached and served without having to invoke PHP every time...</description>
		<content:encoded><![CDATA[<p>&#8230;except that serving a PHP page is much more expensive in terms of memory and CPU cycles, also i can&#8217;t seriously imagine where you would need generated CSS; i&#8217;m sure the output of your elaborate loops could be cached and served without having to invoke PHP every time&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: yaqoob</title>
		<link>http://www.davidgagne.net/2008/10/01/parsing-php-in-css/#comment-369013</link>
		<dc:creator>yaqoob</dc:creator>
		<pubDate>Fri, 20 Mar 2009 01:51:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.davidgagne.net/?p=6985#comment-369013</guid>
		<description>would it be possible to apply AddHandler to only specific files and/or directories? forcing to process all css files around all website (lets say in wordpress installation with multiple plugins) would force you to add the header declaration to all these files around and that would be tiring to say least</description>
		<content:encoded><![CDATA[<p>would it be possible to apply AddHandler to only specific files and/or directories? forcing to process all css files around all website (lets say in wordpress installation with multiple plugins) would force you to add the header declaration to all these files around and that would be tiring to say least</p>
]]></content:encoded>
	</item>
</channel>
</rss>

