<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ExplodingBoy &#187; PHP</title>
	<atom:link href="http://www.exploding-boy.com/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.exploding-boy.com</link>
	<description>A weblog about design, music, entertainment and life.</description>
	<lastBuildDate>Wed, 20 Jul 2011 15:57:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Simple Time Sensitive CSS</title>
		<link>http://www.exploding-boy.com/2008/06/16/simple-time-sensitive-css/</link>
		<comments>http://www.exploding-boy.com/2008/06/16/simple-time-sensitive-css/#comments</comments>
		<pubDate>Mon, 16 Jun 2008 13:45:05 +0000</pubDate>
		<dc:creator>Christopher</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Site]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.exploding-boy.com/?p=267</guid>
		<description><![CDATA[With the most recent redesign of this site, about a year ago, I decided I wanted to mix things up a little and display a different look/design for each month. I wanted the main page of the site to change with each month, but have the individual entries maintain the look of the month it [...]]]></description>
			<content:encoded><![CDATA[<p>With the most recent redesign of this site, about a year ago, I decided I wanted to mix things up a little and display a different look/design for each month. I wanted the main page of the site to change with each month, but have the individual entries maintain the look of the month it was written. Using a little bit of PHP, 13 different stylesheets, and some handy WordPress conditionals I was able to do just that.<br />
<span id="more-267"></span></p>
<h4>Stylesheets A&#8217; Plenty</h4>
<p>I started by first creating 13 different stylesheets. The first one I created was a base stylesheet containing the basic structure of site. The other stylesheets containing color changes to the header, headings, and link colors, were created for every month. I saved each of the monthly stylesheets by month number, so September&#8217;s stylesheet was saved as 9.css, June&#8217;s was 6.css and December&#8217;s was 12.css. You can take a look through the archived entries on this site to see the various styling for each month.</p>
<h4>Taking Advantage of WordPress Conditional Tags</h4>
<p><a href="http://codex.wordpress.org/Conditional_Tags">WordPress conditional tags</a> are an easy way to tell WordPress to alter various elements within your theme depending on certain conditions. Most early themes for WordPress take advantage of conditional tags to display different content in the sidebar of a page depending on your current location on the site. In order to keep the current month&#8217;s look on the front page of my site, but have the individual entries maintain the look of the month it was written I set up a conditional that said if the page <code>is_single() </code> then display the stylesheet of the month it was published. If we are not on a single entry page then display the current month&#8217;s stylesheet. Here&#8217;s what it looks like:<br />
<code><br />
&lt; ?php if (is_single() ) { ?&gt;<br />
&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;http://sitename.com/&lt;?php the_time('n'); ?&gt;.css&quot; /&gt;<br />
&lt; ?php } else { ?&gt;<br />
&lt;link rel=&quot;stylesheet&rdquo; type=&quot;text/css&quot; href=&quot;http://sitename.com/&lt;?php echo date('n'); ?&gt;.css&quot; /&gt;<br />
&lt; ?php } ?&gt;<br />
</code></p>
<h4>PHP</h4>
<p>Notice the small bit of PHP within the conditional we set up &#8211; <code>&lt;?php echo date('n'); ?&gt;</code>?  I replaced the name of the imported CSS file with a short snippet of PHP, which in turn generates a numerical value of one through twelve depending on the month, and appends the *.css file extension. This is why I saved my monthly stylesheets by month number. You can read more about the <a href="http://us.php.net/datetime">PHP Date/Time functions</a> and decide what format is best for you.</p>
<h4>Options</h4>
<p>If you are not using WordPress you can still easily accomplish the same switching of stylesheets with some simple javascript or server side methods. Once you are familiar with some the options of the PHP Date/Time functions you can experiment with changing the look of your site at any interval you like.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.exploding-boy.com/2008/06/16/simple-time-sensitive-css/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

