<?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: Timed CSS Stylesheet Switch Using PHP Tutorial</title>
	<atom:link href="http://www.webm.ag/2010/01/19/timed-css-stylesheet-switch-using-php-tutorial/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.webm.ag/2010/01/19/timed-css-stylesheet-switch-using-php-tutorial/</link>
	<description>Freebies, Tutorials and Other Knick Knacks</description>
	<lastBuildDate>Mon, 07 Jun 2010 18:45:53 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Really Useful Tutorials You Should Have Read in January 2010 Ajax Help W3C Tag</title>
		<link>http://www.webm.ag/2010/01/19/timed-css-stylesheet-switch-using-php-tutorial/comment-page-1/#comment-2472</link>
		<dc:creator>Really Useful Tutorials You Should Have Read in January 2010 Ajax Help W3C Tag</dc:creator>
		<pubDate>Thu, 11 Feb 2010 08:30:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.webm.ag/?p=3087#comment-2472</guid>
		<description>[...] Timed CSS Stylesheet Switch Using PHP By McBonio, January 19th, 2010 Site: WebM.ag [...]</description>
		<content:encoded><![CDATA[<p>[...] Timed CSS Stylesheet Switch Using PHP By McBonio, January 19th, 2010 Site: WebM.ag [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Resources, free stuff, and design articles through 1/24</title>
		<link>http://www.webm.ag/2010/01/19/timed-css-stylesheet-switch-using-php-tutorial/comment-page-1/#comment-2038</link>
		<dc:creator>Resources, free stuff, and design articles through 1/24</dc:creator>
		<pubDate>Sun, 24 Jan 2010 19:52:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.webm.ag/?p=3087#comment-2038</guid>
		<description>[...] Timed CSS stylesheet change with PHP &#8211; The tutorial uses different stylesheets to show the time changing through the day, but this technique has other practical uses. [...]</description>
		<content:encoded><![CDATA[<p>[...] Timed CSS stylesheet change with PHP &#8211; The tutorial uses different stylesheets to show the time changing through the day, but this technique has other practical uses. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cambia las CSS seg&#250;n la hora del d&#237;a &#124; Recursos para Diseñadores Gráficos y Web &#124; Creativos Online</title>
		<link>http://www.webm.ag/2010/01/19/timed-css-stylesheet-switch-using-php-tutorial/comment-page-1/#comment-2026</link>
		<dc:creator>Cambia las CSS seg&#250;n la hora del d&#237;a &#124; Recursos para Diseñadores Gráficos y Web &#124; Creativos Online</dc:creator>
		<pubDate>Sun, 24 Jan 2010 05:52:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.webm.ag/?p=3087#comment-2026</guid>
		<description>[...] Enlace &#124; webm.ag [...]</description>
		<content:encoded><![CDATA[<p>[...] Enlace | webm.ag [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Timed CSS Stylesheet Switch Using PHP Tutorial &#124; JasonCypret.com</title>
		<link>http://www.webm.ag/2010/01/19/timed-css-stylesheet-switch-using-php-tutorial/comment-page-1/#comment-1963</link>
		<dc:creator>Timed CSS Stylesheet Switch Using PHP Tutorial &#124; JasonCypret.com</dc:creator>
		<pubDate>Fri, 22 Jan 2010 16:12:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.webm.ag/?p=3087#comment-1963</guid>
		<description>[...] at webm.ag       [...]</description>
		<content:encoded><![CDATA[<p>[...] at webm.ag       [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Davide Michel Morelli</title>
		<link>http://www.webm.ag/2010/01/19/timed-css-stylesheet-switch-using-php-tutorial/comment-page-1/#comment-1953</link>
		<dc:creator>Davide Michel Morelli</dc:creator>
		<pubDate>Fri, 22 Jan 2010 08:28:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.webm.ag/?p=3087#comment-1953</guid>
		<description>Cool. I will insert it into my provate next project. Tnx.</description>
		<content:encoded><![CDATA[<p>Cool. I will insert it into my provate next project. Tnx.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben</title>
		<link>http://www.webm.ag/2010/01/19/timed-css-stylesheet-switch-using-php-tutorial/comment-page-1/#comment-1951</link>
		<dc:creator>Ben</dc:creator>
		<pubDate>Thu, 21 Jan 2010 23:58:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.webm.ag/?p=3087#comment-1951</guid>
		<description>Cool. I saw something similar which switched stylesheets according to the weather using the Yahoo API. Worked really nicely.</description>
		<content:encoded><![CDATA[<p>Cool. I saw something similar which switched stylesheets according to the weather using the Yahoo API. Worked really nicely.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrius</title>
		<link>http://www.webm.ag/2010/01/19/timed-css-stylesheet-switch-using-php-tutorial/comment-page-1/#comment-1945</link>
		<dc:creator>Andrius</dc:creator>
		<pubDate>Thu, 21 Jan 2010 15:05:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.webm.ag/?p=3087#comment-1945</guid>
		<description>Very nice and clear! Thank You!</description>
		<content:encoded><![CDATA[<p>Very nice and clear! Thank You!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: McBonio</title>
		<link>http://www.webm.ag/2010/01/19/timed-css-stylesheet-switch-using-php-tutorial/comment-page-1/#comment-1929</link>
		<dc:creator>McBonio</dc:creator>
		<pubDate>Thu, 21 Jan 2010 00:24:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.webm.ag/?p=3087#comment-1929</guid>
		<description>Thanks Hans, very nice example there!</description>
		<content:encoded><![CDATA[<p>Thanks Hans, very nice example there!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hans Kuijpers</title>
		<link>http://www.webm.ag/2010/01/19/timed-css-stylesheet-switch-using-php-tutorial/comment-page-1/#comment-1928</link>
		<dc:creator>Hans Kuijpers</dc:creator>
		<pubDate>Thu, 21 Jan 2010 00:19:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.webm.ag/?p=3087#comment-1928</guid>
		<description>Nicely done... December 2008 Yootheme did the same on their Joomla template Daylight.
http://demo.yootheme.com/dec08

The script to read time and set CSS can be found in 
http://demo.yootheme.com/dec08/templates/yoo_daylight/lib/js/template.js.php&quot;
With this script they add a class to a tag.
So ... instead of body, you get body. -&gt; body.noon body.morning

With this, you can reduce the css files from 4 to 1... It also reduces the HTTP requests.</description>
		<content:encoded><![CDATA[<p>Nicely done&#8230; December 2008 Yootheme did the same on their Joomla template Daylight.<br />
<a href="http://demo.yootheme.com/dec08" onclick="return TrackClick('http%3A%2F%2Fdemo.yootheme.com%2Fdec08','http%3A%2F%2Fdemo.yootheme.com%2Fdec08')" rel="nofollow">http://demo.yootheme.com/dec08</a></p>
<p>The script to read time and set CSS can be found in<br />
<a href="http://demo.yootheme.com/dec08/templates/yoo_daylight/lib/js/template.js.php" onclick="return TrackClick('http%3A%2F%2Fdemo.yootheme.com%2Fdec08%2Ftemplates%2Fyoo_daylight%2Flib%2Fjs%2Ftemplate.js.php','http%3A%2F%2Fdemo.yootheme.com%2Fdec08%2Ftemplates%2Fyoo_daylight%2Flib%2Fjs%2Ftemplate.js.php')" rel="nofollow">http://demo.yootheme.com/dec08/templates/yoo_daylight/lib/js/template.js.php</a>&#8221;<br />
With this script they add a class to a tag.<br />
So &#8230; instead of body, you get body. -&gt; body.noon body.morning</p>
<p>With this, you can reduce the css files from 4 to 1&#8230; It also reduces the HTTP requests.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 85+ Fresh Community Articles for Designers and Developers &#124; Afif Fattouh - Web Specialist</title>
		<link>http://www.webm.ag/2010/01/19/timed-css-stylesheet-switch-using-php-tutorial/comment-page-1/#comment-1925</link>
		<dc:creator>85+ Fresh Community Articles for Designers and Developers &#124; Afif Fattouh - Web Specialist</dc:creator>
		<pubDate>Wed, 20 Jan 2010 21:08:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.webm.ag/?p=3087#comment-1925</guid>
		<description>[...] Timed CSS Stylesheet Switch Using PHP Tutorial [...]</description>
		<content:encoded><![CDATA[<p>[...] Timed CSS Stylesheet Switch Using PHP Tutorial [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: McBonio</title>
		<link>http://www.webm.ag/2010/01/19/timed-css-stylesheet-switch-using-php-tutorial/comment-page-1/#comment-1921</link>
		<dc:creator>McBonio</dc:creator>
		<pubDate>Wed, 20 Jan 2010 14:21:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.webm.ag/?p=3087#comment-1921</guid>
		<description>Good idea Loz, looks like it would work to me!

Definitely another good take on it, thanks for the input :)</description>
		<content:encoded><![CDATA[<p>Good idea Loz, looks like it would work to me!</p>
<p>Definitely another good take on it, thanks for the input <img src='http://www.webm.ag/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Loz</title>
		<link>http://www.webm.ag/2010/01/19/timed-css-stylesheet-switch-using-php-tutorial/comment-page-1/#comment-1920</link>
		<dc:creator>Loz</dc:creator>
		<pubDate>Wed, 20 Jan 2010 12:51:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.webm.ag/?p=3087#comment-1920</guid>
		<description>Another possibility (if you wanted to stick with a single stylesheet) would be to simply change the id or class of your body with php, and then just prepend your css definitions with the class (and have no definition for default) eg:

#header {...} /*default header css*/
body.nighttime #header {...} /*used on top of the default - replace only the properties that need to change*/

Ive used a similar approach to allow switching site styles with javascript client-side (not really the problem described in the article, but similar). In that case I have a separate css file called styles.css that defines just the non-default modifications. This may not be a sensible move, but it made sense at the time, and is WIP.

Another possibility for cleaning up the printout:
//specify endtime of the period
$timeStyles = array(
   05=&gt;&quot;nighttime.css&quot;, 
   11=&gt;&quot;morning.css&quot;, 
   18=&gt;&quot;midday.css&quot;, 
   22=&gt;&quot;gettingdark.css&quot;, 
   24=&gt;&quot;nighttime.css&quot;);

//then print out the correct filename
foreach($timeStyles as $endHour=&gt;$fileName) { if($thetime &lt;= $endHour) { echo $fileName; break; } }

...I just knocked this up - dunno if it is cleaner, nicer, more sensible, or even works - just a random idea.

(also dunno of angle-brackets will be lost on posting...dont beat me if it looks weird ;) )</description>
		<content:encoded><![CDATA[<p>Another possibility (if you wanted to stick with a single stylesheet) would be to simply change the id or class of your body with php, and then just prepend your css definitions with the class (and have no definition for default) eg:</p>
<p>#header {&#8230;} /*default header css*/<br />
body.nighttime #header {&#8230;} /*used on top of the default &#8211; replace only the properties that need to change*/</p>
<p>Ive used a similar approach to allow switching site styles with javascript client-side (not really the problem described in the article, but similar). In that case I have a separate css file called styles.css that defines just the non-default modifications. This may not be a sensible move, but it made sense at the time, and is WIP.</p>
<p>Another possibility for cleaning up the printout:<br />
//specify endtime of the period<br />
$timeStyles = array(<br />
   05=&gt;&#8221;nighttime.css&#8221;,<br />
   11=&gt;&#8221;morning.css&#8221;,<br />
   18=&gt;&#8221;midday.css&#8221;,<br />
   22=&gt;&#8221;gettingdark.css&#8221;,<br />
   24=&gt;&#8221;nighttime.css&#8221;);</p>
<p>//then print out the correct filename<br />
foreach($timeStyles as $endHour=&gt;$fileName) { if($thetime &lt;= $endHour) { echo $fileName; break; } }</p>
<p>&#8230;I just knocked this up &#8211; dunno if it is cleaner, nicer, more sensible, or even works &#8211; just a random idea.</p>
<p>(also dunno of angle-brackets will be lost on posting&#8230;dont beat me if it looks weird <img src='http://www.webm.ag/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  )</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: McBonio</title>
		<link>http://www.webm.ag/2010/01/19/timed-css-stylesheet-switch-using-php-tutorial/comment-page-1/#comment-1902</link>
		<dc:creator>McBonio</dc:creator>
		<pubDate>Tue, 19 Jan 2010 21:54:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.webm.ag/?p=3087#comment-1902</guid>
		<description>Thanks Alan, it probably could be a little shorter I must admit!

I used multiple CSS files as potentially the entire layout could be changed rather than various elements on page, my example only shows one change as I felt designing 4 unique themes was a little OTT for a quick tutorial.

Thanks for the input :)</description>
		<content:encoded><![CDATA[<p>Thanks Alan, it probably could be a little shorter I must admit!</p>
<p>I used multiple CSS files as potentially the entire layout could be changed rather than various elements on page, my example only shows one change as I felt designing 4 unique themes was a little OTT for a quick tutorial.</p>
<p>Thanks for the input <img src='http://www.webm.ag/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alan</title>
		<link>http://www.webm.ag/2010/01/19/timed-css-stylesheet-switch-using-php-tutorial/comment-page-1/#comment-1901</link>
		<dc:creator>Alan</dc:creator>
		<pubDate>Tue, 19 Jan 2010 21:39:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.webm.ag/?p=3087#comment-1901</guid>
		<description>My comments got mangled

1 was to check for the other times and then just say else night time.

2. the point was to use to use the if to assign $TimeOfDay and then echo it in the image tag, therefore needing only one css file.</description>
		<content:encoded><![CDATA[<p>My comments got mangled</p>
<p>1 was to check for the other times and then just say else night time.</p>
<p>2. the point was to use to use the if to assign $TimeOfDay and then echo it in the image tag, therefore needing only one css file.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alan</title>
		<link>http://www.webm.ag/2010/01/19/timed-css-stylesheet-switch-using-php-tutorial/comment-page-1/#comment-1900</link>
		<dc:creator>Alan</dc:creator>
		<pubDate>Tue, 19 Jan 2010 21:34:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.webm.ag/?p=3087#comment-1900</guid>
		<description>Two thoughts:

1. Your if statement can be shortened (perhaps you were just making it obvious what all the cases might be):

if($thetime &gt; 05 AND $thetime  11 AND $thetime  18 AND $thetime &lt; 23) { echo &quot;gettingdark.css&quot;;} // between 7pm and 11pm
else { echo &quot;nighttime.css&quot;;} // between midnight and 6am

2. Since 4 or more files are harder to maintain, it might be better to use one css file that uses a snippet of PHP to assign the image. Just change the if statement to assign a variable and then the img tag uses 
src=&quot;&quot; 
and
title=&quot;&quot;</description>
		<content:encoded><![CDATA[<p>Two thoughts:</p>
<p>1. Your if statement can be shortened (perhaps you were just making it obvious what all the cases might be):</p>
<p>if($thetime &gt; 05 AND $thetime  11 AND $thetime  18 AND $thetime &lt; 23) { echo &quot;gettingdark.css&quot;;} // between 7pm and 11pm<br />
else { echo &quot;nighttime.css&quot;;} // between midnight and 6am</p>
<p>2. Since 4 or more files are harder to maintain, it might be better to use one css file that uses a snippet of PHP to assign the image. Just change the if statement to assign a variable and then the img tag uses<br />
src=&quot;&#8221;<br />
and<br />
title=&#8221;"</p>
]]></content:encoded>
	</item>
</channel>
</rss>
