<?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>Design, Development, and Consulting</title>
	<atom:link href="http://netlumination.com/feed" rel="self" type="application/rss+xml" />
	<link>http://netlumination.com</link>
	<description>A web design, development, and consulting firm based in Portland, Oregon helping small businesseses and individuals.</description>
	<lastBuildDate>Wed, 01 Sep 2010 23:27:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Visibility Toggling with jQuery</title>
		<link>http://netlumination.com/blog/visibility-toggling-with-jquery</link>
		<comments>http://netlumination.com/blog/visibility-toggling-with-jquery#comments</comments>
		<pubDate>Mon, 16 Aug 2010 22:10:18 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[toggling]]></category>
		<category><![CDATA[visibility]]></category>

		<guid isPermaLink="false">http://netlumination.com/?p=1361</guid>
		<description><![CDATA[User interface design often makes use of showing and hiding blocks of content. It focuses one&#8217;s attention to the right thing, and it&#8217;s fun to do with jQuery. I&#8217;ll show you how to toggle the visibility on a group of selected elements. I&#8217;ll build up from a simple case to the more complicated ultimate goal. [...]]]></description>
			<content:encoded><![CDATA[<p>User interface design often makes use of showing and hiding blocks of content. It focuses one&#8217;s attention to the right thing, and it&#8217;s fun to do with <a href="http://jquery.com/">jQuery</a>.</p>
<p>I&#8217;ll show you how to toggle the visibility on a group of selected elements. I&#8217;ll build up from a simple case to the more complicated ultimate goal.</p>
<p><span id="more-1361"></span></p>
<p>First, whenever you&#8217;re working with jQuery and Javascript, you should probably get your references ready. For online references there&#8217;s the<a href="http://docs.jquery.com/Main_Page"> jQuery documentation</a> (which is easier to search with Google than with the site search, I find) and the <a href="https://developer.mozilla.org/en/javascript">Mozilla Development Center Javascript reference</a> among others. A very nice site to test, store, and share your jQuery snippets is <a href="http://jsfiddle.net/">jsFiddle</a>.</p>
<p>Ok, let&#8217;s get started. First let&#8217;s toggle the visibility of an element with jQuery using <a href="http://api.jquery.com/toggle/">.toggle()</a>. Since we&#8217;re talking about user interfaces, we&#8217;ll probably trigger the toggle with an action, let&#8217;s say a <a href="http://api.jquery.com/click/">.click()</a>:</p>
<ol>
<li>
<pre>$(document).ready(function(){</pre>
</li>
<li>
<pre>      // Toggle the visibility of all divs when one is clicked.</pre>
</li>
<li>
<pre>    $("input").click(function() {</pre>
</li>
<li>
<pre>        $("div").toggle();</pre>
</li>
<li>
<pre>    });</pre>
</li>
<li>
<pre>});​​</pre>
</li>
</ol>
<p><a href="http://jsfiddle.net/QXZ7p/">jsFiddle example</a></p>
<p>The code above will toggle the visibility of all the divs on a page if an input button is pressed.  The way this works is that after the document is ready, an event handler is bound to all the &lt;input&gt; elements. The handler waits for the user to click it. If clicked jQuery selects all the divs on the page and reverses their visibility. If they were invisible they become visible and vica versa.</p>
<p>Well, this was just to give you a tast of .toggle(), since the above example is pretty crude. Usually you want more control over which divs appear and disappear. In fact, an often trick part of visibility toggling in jQuery is to make sure each toggling button is linked uniquely to one block of content. You also want to ensure that when a block of content appears, all the other similar blocks of content disappears.</p>
<p>I&#8217;ll show you two methods of making sure that each time only one block of content appears, while all the other blocks of content disappears. The first method will only work if all the content blocks are siblings in the DOM. This will often be the case, since we&#8217;ll usually be dealing with semantically related chunks of content. The second way will be a little trickier but more flexible.</p>
<p>But before we start discussing siblings, let&#8217;s make sure we can toggle one specific div with one particular button. There&#8217;s many ways of doing this. I&#8217;ll show you how to use individual but related ids for the buttons and the content divs. Each button will have a name like, &#8220;block-x&#8221; where &#8220;x&#8221; is a number, and it&#8217;ll have a corresponding content block with the id &#8220;block-x-content&#8221;. Now if we have 3 content blocks, we could write one functions to control each block, for a total of 3 functions, but it&#8217;s more convenient and maintainable to generalize. We&#8217;re going to use input buttons with class &#8220;.toggler&#8221; to toggle the divs. You, of course, don&#8217;t have to use buttons, you can use other divs, or images, or whatever your little heart desires. So, so far we have:</p>
<ol>
<li>
<pre>$(document).ready(function(){</pre>
</li>
<li>
<pre>      // Toggle the visibility of all divs when one is clicked.</pre>
</li>
<li>
<pre>    $("input.toggler").click(function() {</pre>
</li>
<li>
<pre>        $( "#" + $(this).attr("id") + "-content" ).toggle();</pre>
</li>
<li>
<pre>    });</pre>
</li>
<li>
<pre>});​</pre>
</li>
</ol>
<p><a href="http://jsfiddle.net/N4PDK/">jsFiddle example</a></p>
<p>The most complex part is the line with the toggle. The previous line simply binds an click event handler to all input elements with a &#8220;toggler&#8221; class. The function that is triggered in case of a click is an anonymous function that toggles one div. To see witch div gets toggled we&#8217;ll look more closely at &#8220;$(&#8220;#&#8221; + $(this).attr(&#8220;id&#8221;) + &#8220;-content&#8221; )&#8221; . The part inside the parentheses is simply a jQuery selector string. The string starts with a literal &#8220;#&#8221;, so we know that an element with a certain ID is getting toggled. The &#8220;#&#8221; is followed by the &#8220;ID&#8221; attribute of the element that was clicked. So far we have something like $(&#8220;#block-x&#8221;). This by itself would make the buttons disappear. But we know that each button has a corresponding content block. This block is selected by concatenating &#8220;-content&#8221; to the previous to give us a toggling of $(&#8220;#block-x-content&#8221;). Where is the number in the ID attribute of the INPUT button we clicked. Notice how the visibility of each DIV is kept track of separately. .toggle() is doing all the hard work for us.</p>
<p>Well, we&#8217;re approaching what we want. The previous example is okay, in that it let&#8217;s us toggle things, but it doesn&#8217;t really feel like we&#8217;re concentrating the attention of the user to one pertinent block of information. To achieve that end, we must make all the other divs invisible when we make one div visible.</p>
<p>We only have to change one line to achieve this. We&#8217;ll go from:</p>
<pre>$( "#" + $(this).attr("id") + "-content" ).toggle();</pre>
<p>to:</p>
<pre>$( "#" + $(this).attr("id") + "-content" ).toggle().siblings().hide();</pre>
<p>Notice how I chained the methods .siblings() and .hide() onto the previous line. This means that after toggling our content block, we&#8217;ll select the DOM siblings of that block and make them invisible. This means you have to make sure you&#8217;ve thought through your HTML. The easy way to do this is to nest all the content divs into a parent div, or if it makes sense, maybe to have content LIs in a parent UL or OL.</p>
<p>One finally change is that you may not want the content to disappear if a button is pressed twice, so we&#8217;ll switch out .toggle() with .show() to give:</p>
<ol>
<li>
<pre>$(document).ready(function(){</pre>
</li>
<li>
<pre>      // Toggle the visibility of all divs when one is clicked.</pre>
</li>
<li>
<pre>    $("input.toggler").click(function() {</pre>
</li>
<li>
<pre>        $( "#" + $(this).attr("id") + "-content" ).show().siblings().hide();</pre>
</li>
<li>
<pre>    });</pre>
</li>
<li>
<pre>});​</pre>
</li>
</ol>
<p><a href="http://jsfiddle.net/NeVDs/">jsFiddle example</a></p>
<p>But what if our content DIVs aren&#8217;t siblings? They usually should be, just because of the way information is structured on an HTML page, but we really don&#8217;t want to count on that. We want the flexibility to toggle any set of elements we want.</p>
<p>To toggle any set of elements we want, all we have to do is create jQuery set of the elements and use .not() in combination with that. I&#8217;ll show you how.</p>
<p>First, let&#8217;s say that we have 3 content divs. Let&#8217;s select all of them with jQuery:</p>
<pre>
var theDivs = $("#block-1-content, #block-2-content, #block-3-content);
</pre>
<p>So, now theDivs is a jQuery selection of out content DIVs, let&#8217;s use that in combination with our click handler and .not() to toggle the appropriate content divs. Except, now I&#8217;m going to use an unordered list, so our content will be in LIs. If we&#8217;re dealing with unordered lists, we could easy have a situation where all the individual content LIs are not siblings of each other.</p>
<p>To show the corresponding content LI of a button, we&#8217;ll still use:</p>
<pre>
$( "#" + $(this).attr("id") + "-content" ).show();
</pre>
<p>But now we can&#8217;t simply make the siblings disappear. Instead we&#8217;ll make everything from our jQuery slection &#8220;theDivs&#8221; that isn&#8217;t the corresponding content LI vanish. Like this:</p>
<pre>
theDivs.not( $( "#" + $(this).attr("id") + "-content" ) ).hide();
</pre>
<p>And that&#8217;s it! You can of course replace the .show() and .hide() methods with fancier animations like .slideDown() and .slideUp(), but overall we have a relatively simple to implement, generalizable way of toggling the visibility of a group of content divs. The full code will look something like this:</p>
<ol>
<li>
<pre>$(document).ready(function(){</pre>
</li>
<li>
<pre>      // Create a selection of the content divs of interest</pre>
</li>
<li>
<pre>    var theDivs = $("#block-1-content, #block-2-content, #block-3-content");</pre>
</li>
<li>
<pre>      // Toggle the visibility of all divs when one is clicked.</pre>
</li>
<li>
<pre>    $("input.toggler").click(function() {        </pre>
</li>
<li>
<pre>        $( "#" + $(this).attr("id") + "-content" ).show();</pre>
</li>
<li>
<pre>        theDivs.not( $( "#" + $(this).attr("id") + "-content" ) ).hide();</pre>
</li>
<li>
<pre>    });</pre>
</li>
<li>
<pre>});​</pre>
</li>
</ol>
<p><a href="http://jsfiddle.net/NNLzj/">jsFiddle example</a></p>
]]></content:encoded>
			<wfw:commentRss>http://netlumination.com/blog/visibility-toggling-with-jquery/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Data Visualization</title>
		<link>http://netlumination.com/blog/data-visualization</link>
		<comments>http://netlumination.com/blog/data-visualization#comments</comments>
		<pubDate>Fri, 30 Jul 2010 01:37:18 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Zany]]></category>
		<category><![CDATA[visualization]]></category>

		<guid isPermaLink="false">http://netlumination.com/?p=1345</guid>
		<description><![CDATA[Sleeping time is a site with an interesting idea. It takes the time of a Twitter user&#8217;s Tweets, and it makes a guess at their sleep schedule. The idea is that if you&#8217;re sleeping, you won&#8217;t Tweet (obviously this only applies to amateur Tweeters). Once you enter a person&#8217;s nickname, the site draws out a [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sleepingtime.org/">Sleeping time</a> is a site with an interesting idea. It takes the time of a Twitter user&#8217;s Tweets, and it makes a guess at their sleep schedule. The idea is that if you&#8217;re sleeping, you won&#8217;t Tweet (obviously this only applies to amateur Tweeters). Once you enter a person&#8217;s nickname, the site draws out a visualization of the sleep schedule. For example <a href="http://www.sleepingtime.org/Peter_Ajtai">here is my sleep schedule</a>.</p>
<p><img class="aligncenter size-full wp-image-1346" title="Sleep" src="http://netlumination.com/wp-content/uploads/2010/07/sleep.jpg" alt="sleep schedule" width="440" height="256" />Well, the first impression one gets is that I sleep as much as a<a href="http://science.education.nih.gov/supplements/nih3/sleep/guide/info-sleep.htm"> brown bat</a> (19.9 hours per day apparently). The red area is much larger than half the clock, so it looks like I sleep the whole day away.</p>
<p>Of course the clock only has 12 hours on it, so while it looks like I sleep 2/3 of the day, I actually only sleep half of that, or 1/3 of the day, according to Sleeping Time.</p>
<p>So, if the visualization doesn&#8217;t give you a quick visual idea of what portion of a day you spend sleeping, what is it good for? It tells you what portion of half a day you spend sleeping, but that&#8217;s not really a metric that&#8217;s ingrained in any of our brains.</p>
<p>This is the problem with data visualization. A graph often looks clear cut and simple, but it is often simply not showing you an answer to the question your are asking.</p>
<p>If you found this post even mildly interesting, then you should know that a great book about graphs, charts, and other ways of showing data is <a href="http://www.amazon.com/gp/product/0961392142?ie=UTF8&amp;tag=slugophile-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0961392142">The Visual Display of Quantitative Information</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://netlumination.com/blog/data-visualization/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A few code snippets.</title>
		<link>http://netlumination.com/blog/a-few-code-snippets</link>
		<comments>http://netlumination.com/blog/a-few-code-snippets#comments</comments>
		<pubDate>Sun, 25 Jul 2010 02:40:09 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[samples]]></category>

		<guid isPermaLink="false">http://netlumination.com/?p=1325</guid>
		<description><![CDATA[I often write very short, very simply little code snippets just to test specific things in HTML, CSS, PHP, or Javascript (and jQuery).  These are short little blurbs, that are useful for looking at how certain specific things work. They are mostly notes to self. Here are links to a few of them: Short Code [...]]]></description>
			<content:encoded><![CDATA[<p>I often write very short, very simply little code snippets just to test specific things in HTML, CSS, PHP, or Javascript (and jQuery).  These are short little blurbs, that are useful for looking at how certain specific things work. They are mostly notes to self.</p>
<p>Here are links to a few of them:</p>
<table>
<tbody>
<tr>
<td colspan="2"><strong>Short Code Snippets:</strong></td>
</tr>
<tr>
<td>CSS</td>
<td><a href="http://peter-ajtai.com/examples/html/images.php">Change image on hover.</a></td>
</tr>
<tr>
<td>CSS</td>
<td><a href="http://peter-ajtai.com/examples/html/menu-good.html">Creating large clickable areas.</a></td>
</tr>
<tr>
<td>CSS</td>
<td><a href="http://peter-ajtai.com/examples/html/sample.html">Images sprites example</a> &#8211; <a href="http://peter-ajtai.com/examples/html/styles.css">External CSS is here</a> &#8211; <a href="http://peter-ajtai.com/examples/html/images/sprite.png">Sprite is here</a></td>
</tr>
<tr>
<td>DOM</td>
<td><a href="http://peter-ajtai.com/examples/html/dom.php">Checking how many elements in an ID.</a></td>
</tr>
<tr>
<td>Javascript</td>
<td><a href="http://peter-ajtai.com/examples/js/animation.php">Basketball animation</a></td>
</tr>
<tr>
<td>jQuery</td>
<td><a href="http://peter-ajtai.com/examples/js/custom-iteration.php">Return ID of clicked LI</a></td>
</tr>
<tr>
<td>jQuery</td>
<td><a href="http://peter-ajtai.com/examples/js/jq-exs.php">Sliding, fading, and disappearing</a></td>
</tr>
<tr>
<td>jQuery</td>
<td><a href="http://peter-ajtai.com/examples/js/not.php">Not this array element</a></td>
</tr>
<tr>
<td>jQuery</td>
<td><a href="http://peter-ajtai.com/examples/js/toggle.php">Using toggle()</a></td>
</tr>
<tr>
<td>PHP Algorithm</td>
<td><a href="http://peter-ajtai.com/examples/php/lll.php">A linear linked list</a></td>
</tr>
<tr>
<td>PHP Recursion</td>
<td><a href="http://peter-ajtai.com/examples/numbers.php">Turning digits into words</a></td>
</tr>
<tr>
<td>PHP JSON CSS</td>
<td><a href="http://peter-ajtai.com/examples/php/del.php">Retrieving and displaying information from Delicious</a></td>
</tr>
<tr>
<td colspan="2"><strong>Simple Apps:</strong></td>
</tr>
<tr>
<td>jQuery PHP</td>
<td><a href="http://peter-ajtai.com/examples/php/so.php">Guessing game using Stackapps and Stackoverflow data</a></td>
</tr>
<tr>
<td>jQuery PHP</td>
<td><a href="http://peter-ajtai.com/examples/js/highlight.php">Dynamic Syntax Highlighting</a></td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://netlumination.com/blog/a-few-code-snippets/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pimp My Web Page: Simple to Complex</title>
		<link>http://netlumination.com/blog/pimp-my-web-page-simple-to-complex</link>
		<comments>http://netlumination.com/blog/pimp-my-web-page-simple-to-complex#comments</comments>
		<pubDate>Tue, 22 Jun 2010 06:28:51 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Website Advice]]></category>
		<category><![CDATA[optimization]]></category>

		<guid isPermaLink="false">http://netlumination.com/?p=1260</guid>
		<description><![CDATA[Let&#8217;s start with the simplest web page: &#60;h1&#62;Hello World!&#60;/h1&#62; Well, that&#8217;s nice, but there&#8217;s certain information missing. We should add a doctype to let the browser know what flavor of HTML, XHTML, etc we&#8217;re using. This declares the document type definition (DTD) in use for the document. We should also add things like the HTML [...]]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s start with the simplest web page:</p>
<ol>
<li>
<pre>&lt;h1&gt;Hello World!&lt;/h1&gt;</pre>
</li>
</ol>
<p>Well, that&#8217;s nice, but there&#8217;s <a href="http://www.w3.org/TR/html401/struct/global.html">certain information missing</a>. We should add a doctype to let the browser know what flavor of HTML, XHTML, etc we&#8217;re using. This declares the document type definition (DTD) in use for the document.</p>
<p>We should also add things like the HTML elements, a HEAD element for specifying more information about the page, a BODY for the contents.</p>
<p>We should also let the browser know our character encoding with a meta tag.</p>
<p>So now we have:<span id="more-1260"></span></p>
<ol>
<li>
<pre>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/\\xhtml1/DTD/xhtml1-strict.dtd"&gt;</pre>
</li>
<li>
<pre>&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;</pre>
</li>
<li>
<pre>    &lt;head&gt;</pre>
</li>
<li>
<pre>        &lt;meta http-equiv="Content-Type" content="text/html;charset=utf-8" /&gt;</pre>
</li>
<li>
<pre>        &lt;title&gt;Greetings World&lt;/title&gt;</pre>
</li>
<li>
<pre>    &lt;/head&gt;</pre>
</li>
<li>
<pre>    &lt;body&gt;</pre>
</li>
<li>
<pre>        &lt;h1&gt;Hello World!&lt;/h1&gt;</pre>
</li>
<li>
<pre>    &lt;/body&gt;</pre>
</li>
<li>
<pre>&lt;/html&gt;</pre>
</li>
</ol>
<p>What about the look of the page? Let&#8217;s add some CSS:</p>
<ol>
<li>
<pre>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/\\xhtml1/DTD/xhtml1-strict.dtd"&gt;</pre>
</li>
<li>
<pre>&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;</pre>
</li>
<li>
<pre>    &lt;head&gt;</pre>
</li>
<li>
<pre>        &lt;meta http-equiv="Content-Type" content="text/html;charset=utf-8" /&gt;</pre>
</li>
<li>
<pre>        &lt;title&gt;Greetings World&lt;/title&gt;</pre>
</li>
<li>
<pre>        &lt;style type="text/css"&gt;</pre>
</li>
<li>
<pre>            body {</pre>
</li>
<li>
<pre>                background-color:#BDC4D4;</pre>
</li>
<li>
<pre>            }</pre>
</li>
<li>
<pre>        &lt;/style&gt;</pre>
</li>
<li>
<pre>    &lt;/head&gt;</pre>
</li>
<li>
<pre>    &lt;body&gt;</pre>
</li>
<li>
<pre>        &lt;h1&gt;Hello World!&lt;/h1&gt;</pre>
</li>
<li>
<pre>    &lt;/body&gt;</pre>
</li>
<li>
<pre>&lt;/html&gt;</pre>
</li>
</ol>
<p>Of course we should throw that into an external style sheet:</p>
<ol>
<li>
<pre>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;</pre>
</li>
<li>
<pre>&lt;!-- sample.html --&gt;</pre>
</li>
<li>
<pre>&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;</pre>
</li>
<li>
<pre>    &lt;head&gt;</pre>
</li>
<li>
<pre>        &lt;meta http-equiv="Content-Type" content="text/html;charset=utf-8" /&gt;</pre>
</li>
<li>
<pre>        &lt;title&gt;Greetings World&lt;/title&gt;</pre>
</li>
<li>
<pre>        &lt;link rel="stylesheet" href="styles.css" type="text/css" media="screen" /&gt;</pre>
</li>
<li>
<pre>    &lt;/head&gt;</pre>
</li>
<li>
<pre>    &lt;body&gt;</pre>
</li>
<li>
<pre>        &lt;h1&gt;Hello World!&lt;/h1&gt;</pre>
</li>
<li>
<pre>    &lt;/body&gt;</pre>
</li>
<li>
<pre>&lt;/html&gt;</pre>
</li>
</ol>
<p>and:</p>
<ol>
<li>
<pre>/* styles.css */</pre>
</li>
<li>
<pre>body {</pre>
</li>
<li>
<pre>    background-color:#BDC4D4;</pre>
</li>
<li>
<pre>}</pre>
</li>
</ol>
<p>Let&#8217;s add two images:</p>
<ol>
<li>
<pre>        &lt;p&gt;</pre>
</li>
<li>
<pre>            An Image ==&gt;</pre>
</li>
<li>
<pre>            &lt;img src="images/one.png" alt="image 1" /&gt;</pre>
</li>
<li>
<pre>        &lt;/p&gt;</pre>
</li>
<li>
<pre>        &lt;p&gt;</pre>
</li>
<li>
<pre>            Another Image ==&gt;</pre>
</li>
<li>
<pre>            &lt;img src="images/two.png" alt="image 2" /&gt;</pre>
</li>
<li>
<pre>        &lt;/p&gt;</pre>
</li>
</ol>
<p>Hmmm&#8230; but we&#8217;re making two requests to the server for these two images. We can pass the same amount of information to the user with only one request to the server using <a href="http://www.smashingmagazine.com/2009/04/27/the-mystery-of-css-sprites-techniques-tools-and-tutorials/">sprites</a>.</p>
<p>Sprites are often used in divs or other elements as background images. We&#8217;ll use sprites as background images, but they&#8217;ll be the background to an IMG element. &#8220;null.png&#8221; is simply a transparent pixel:</p>
<p>The HTML:</p>
<ol>
<li>
<pre>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;</pre>
</li>
<li>
<pre>&lt;!-- sample.html --&gt;</pre>
</li>
<li>
<pre>&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;</pre>
</li>
<li>
<pre>    &lt;head&gt;</pre>
</li>
<li>
<pre>        &lt;meta http-equiv="Content-Type" content="text/html;charset=utf-8" /&gt;</pre>
</li>
<li>
<pre>        &lt;title&gt;Greetings World&lt;/title&gt;</pre>
</li>
<li>
<pre>        &lt;link rel="stylesheet" href="styles.css" type="text/css" media="screen" /&gt;</pre>
</li>
<li>
<pre>    &lt;/head&gt;</pre>
</li>
<li>
<pre>    &lt;body&gt;</pre>
</li>
<li>
<pre>        &lt;h1&gt;Hello World!&lt;/h1&gt;</pre>
</li>
<li>
<pre>        &lt;p&gt;</pre>
</li>
<li>
<pre>            An Image ==&gt;</pre>
</li>
<li>
<pre>            &lt;img src="images/null.png" class="sprite image1" alt="image 1" /&gt;</pre>
</li>
<li>
<pre>        &lt;/p&gt;</pre>
</li>
<li>
<pre>        &lt;p&gt;</pre>
</li>
<li>
<pre>            Another Image ==&gt;</pre>
</li>
<li>
<pre>            &lt;img src="images/null.png" class="sprite image2" alt="image 2" /&gt;</pre>
</li>
<li>
<pre>        &lt;/p&gt;</pre>
</li>
<li>
<pre>    &lt;/body&gt;</pre>
</li>
<li>
<pre>&lt;/html&gt;</pre>
</li>
</ol>
<p>The CSS:</p>
<ol>
<li>
<pre>/* styles.css */</pre>
</li>
<li>
<pre>body {</pre>
</li>
<li>
<pre>    background-color:#BDC4D4;</pre>
</li>
<li>
<pre>}</pre>
</li>
<li>
<pre>.sprite {</pre>
</li>
<li>
<pre>    width:80px;</pre>
</li>
<li>
<pre>    height:80px;</pre>
</li>
<li>
<pre>    background:url('images/sprite.png')</pre>
</li>
<li>
<pre>}</pre>
</li>
<li>
<pre>.image2 {</pre>
</li>
<li>
<pre>    background-position:-80px;</pre>
</li>
<li>
<pre>}</pre>
</li>
</ol>
<p>Well, ok, but our sight isn&#8217;t going to change much over time, so once a visitor see our site, they should cache it in their browser for future use. This&#8217;ll make the page load faster for everyone, since it reduces server load, and it speeds up the loading of pages by repeat visitors.</p>
<p>We can accomplich this using HTTP headers. This is not the HTML HEADER tag. HTTP headers are lines that the server sends to the browser before the contents of the page&#8230; this means we can&#8217;t put the HTTP headers into the HTML file. We&#8217;ll have to use something server side for this. PHP has a header() function, which makes things really easy:</p>
<ol>
<li>
<pre>&lt;?php</pre>
</li>
<li>
<pre>// Expires one year from now</pre>
</li>
<li>
<pre>$expires = mktime(0, 0, 0, date("m"),   date("d"),   date("Y")+1);</pre>
</li>
<li>
<pre>// Format date</pre>
</li>
<li>
<pre>$date =  date('D, d M Y H:i:s', $expires);</pre>
</li>
<li>
<pre>// Send HTTP header</pre>
</li>
<li>
<pre>header("Expires: $date GMT");</pre>
</li>
<li>
<pre>?&gt;</pre>
</li>
<li>
<pre>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;</pre>
</li>
<li>
<pre>&lt;!-- sample.html --&gt;</pre>
</li>
<li>
<pre>&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;</pre>
</li>
<li>
<pre>    &lt;head&gt;</pre>
</li>
<li>
<pre>        &lt;meta http-equiv="Content-Type" content="text/html;charset=utf-8" /&gt;</pre>
</li>
<li>
<pre>        &lt;title&gt;Greetings World&lt;/title&gt;</pre>
</li>
<li>
<pre>        &lt;link rel="stylesheet" href="styles.css" type="text/css" media="screen" /&gt;</pre>
</li>
<li>
<pre>    &lt;/head&gt;</pre>
</li>
<li>
<pre>    &lt;body&gt;</pre>
</li>
<li>
<pre>        &lt;h1&gt;Hello World!&lt;/h1&gt;</pre>
</li>
<li>
<pre>        &lt;p&gt;</pre>
</li>
<li>
<pre>            An Image ==&gt;</pre>
</li>
<li>
<pre>            &lt;img src="images/null.png" class="sprite image1" alt="image 1" /&gt;</pre>
</li>
<li>
<pre>        &lt;/p&gt;</pre>
</li>
<li>
<pre>        &lt;p&gt;</pre>
</li>
<li>
<pre>            Another Image ==&gt;</pre>
</li>
<li>
<pre>            &lt;img src="images/null.png" class="sprite image2" alt="image 2" /&gt;</pre>
</li>
<li>
<pre>        &lt;/p&gt;</pre>
</li>
<li>
<pre>    &lt;/body&gt;</pre>
</li>
<li>
<pre>&lt;/html&gt;</pre>
</li>
</ol>
<p>We could have done the above with Apache or whatever server itself we&#8217;re using. PHP is nice for illustration, since we can keep all the code in the HTML file. Since the HTTP header comes before the HTML content, you cannot put any HTML before the PHP header() function.</p>
<p>Ok, now we&#8217;re getting somewhere, but we&#8217;ve still got all this text and stuff on our web page&#8230;. ok we don&#8217;t, but we could have all this stuff, if we had a big web page, or it may look like a lot of stuff to someone with a limping dial up in East Timor. Well, why don&#8217;t we compress all our stuff. Let&#8217;s GZIP it.</p>
<ol>
<li>
<pre>&lt;?php</pre>
</li>
<li>
<pre>// Expires one year from now</pre>
</li>
<li>
<pre>$expires = mktime(0, 0, 0, date("m"),   date("d"),   date("Y")+1);</pre>
</li>
<li>
<pre>// Format date</pre>
</li>
<li>
<pre>$date =  date('D, d M Y H:i:s', $expires);</pre>
</li>
<li>
<pre>// Send HTTP header</pre>
</li>
<li>
<pre>header("Expires: $date GMT");</pre>
</li>
<li>
<pre>if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip'))</pre>
</li>
<li>
<pre>    ob_start("ob_gzhandler");</pre>
</li>
<li>
<pre>else</pre>
</li>
<li>
<pre>    ob_start();</pre>
</li>
<li>
<pre>?&gt;</pre>
</li>
<li>
<pre>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;</pre>
</li>
<li>
<pre>&lt;!-- sample.html --&gt;</pre>
</li>
<li>
<pre>&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;</pre>
</li>
<li>
<pre>    &lt;head&gt;</pre>
</li>
<li>
<pre>        &lt;meta http-equiv="Content-Type" content="text/html;charset=utf-8" /&gt;</pre>
</li>
<li>
<pre>        &lt;title&gt;Greetings World&lt;/title&gt;</pre>
</li>
<li>
<pre>        &lt;link rel="stylesheet" href="styles.css" type="text/css" media="screen" /&gt;</pre>
</li>
<li>
<pre>    &lt;/head&gt;</pre>
</li>
<li>
<pre>    &lt;body&gt;</pre>
</li>
<li>
<pre>        &lt;h1&gt;Hello World!&lt;/h1&gt;</pre>
</li>
<li>
<pre>        &lt;p&gt;</pre>
</li>
<li>
<pre>            An Image ==&gt;</pre>
</li>
<li>
<pre>            &lt;img src="images/null.png" class="sprite image1" alt="image 1" /&gt;</pre>
</li>
<li>
<pre>        &lt;/p&gt;</pre>
</li>
<li>
<pre>        &lt;p&gt;</pre>
</li>
<li>
<pre>            Another Image ==&gt;</pre>
</li>
<li>
<pre>            &lt;img src="images/null.png" class="sprite image2" alt="image 2" /&gt;</pre>
</li>
<li>
<pre>        &lt;/p&gt;</pre>
</li>
<li>
<pre>    &lt;/body&gt;</pre>
</li>
<li>
<pre>&lt;/html&gt;</pre>
</li>
</ol>
<p>You can <a href="http://www.gidnetwork.com/tools/gzip-test.php">confirm that you&#8217;re properly GZIPPED</a>.</p>
<p>Ok. With PHP we can also <a href="http://php.net/manual/en/function.flush.php">flush</a> the buffer early:</p>
<ol>
<li>
<pre>    &lt;/head&gt;</pre>
</li>
<li>
<pre>    &lt;?php flush(); ?&gt;</pre>
</li>
<li>
<pre>    &lt;body&gt;</pre>
</li>
</ol>
<p>It&#8217;s great that our CSS is in its own file, but it still has a bunch of whitespace. Why don&#8217;t we minify it.</p>
<p>I used the <a href="http://developer.yahoo.com/yui/compressor/">YUI compressor</a> with this command:</p>
<ol>
<li>
<pre>java -jar yuicompressor-2.4.2.jar styles.css -o styles.min.css --type css</pre>
</li>
</ol>
<p>To get this CSS file:</p>
<ol>
<li>
<pre>body{background-color:#BDC4D4;}.sprite{width:80px;height:80px;background:url('images/sprite.png');}.image2{background-position:-80px;}</pre>
</li>
</ol>
<p>We can do the same minification with our Javascript if we have any, and remember to include your Javascript as far to the bottom of the page as you can.</p>
<p>Take a look at the <a href="http://peter-ajtai.com/examples/html/sample.php">final page</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://netlumination.com/blog/pimp-my-web-page-simple-to-complex/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JQuery for a little night time reading</title>
		<link>http://netlumination.com/blog/jquery-for-a-little-night-time-reading</link>
		<comments>http://netlumination.com/blog/jquery-for-a-little-night-time-reading#comments</comments>
		<pubDate>Tue, 15 Jun 2010 01:16:26 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[source code]]></category>

		<guid isPermaLink="false">http://netlumination.com/?p=1242</guid>
		<description><![CDATA[If you use Javascript, JQuery is a great framework to speed up your coding. It&#8217;s essentially a collection of really convenient shortcuts. It does more, since JQuery also handles a lot of browser compatibility issues. So, you don&#8217;t have to go through your JQuery code to update it for new browsers, all you have to [...]]]></description>
			<content:encoded><![CDATA[<p>If you use Javascript, <a href="http://jquery.com/">JQuery</a> is a great framework to speed up your coding. It&#8217;s essentially a collection of really convenient shortcuts. It does more, since JQuery also handles a lot of browser compatibility issues. So, you don&#8217;t have to go through your JQuery code to update it for new browsers, all you have to do is download the new version of JQuery, and your old commands will learn new tricks.</p>
<p>Ah, speaking of downloading JQuery, you just might want to understand how JQuery works if you use it. The first time I tried to do this, I simply clicked on my JQuery src file link:</p>
<ol>
<li>
<pre>&lt;script type="text/javascript" src="http://peter-ajtai.com/jquery/jquery-1.4.2.min.js"&gt;&lt;/script&gt;</pre>
</li>
</ol>
<p>&#8230; and this is what I saw:</p>
<p><img class="alignnone size-full wp-image-1243" title="Happy reading" src="http://netlumination.com/wp-content/uploads/2010/06/wall-o-text.jpg" alt="Wall o text JQuery" width="419" height="323" /></p>
<p>Fun reading, huh? <span id="more-1242"></span>Well, when your browser loads Javascript, it has to load each charachter, so the less whitespace there is, and the shorter the variable names are, the faster it will load.</p>
<p>This means you should be using this, the minified, version of JQuery on your site, but if you want some <del>pleasant and relaxing</del> reading&#8230; you should look at the uncompressed version. <a href="http://docs.jquery.com/Downloading_jQuery">JQuery shows you both versions very clearly on their download page</a>, but for some reason, it took me a while to realize that there is an uncompressed version. The <a href="http://code.jquery.com/jquery-latest.js">uncompressed version of the latest version is here</a>. The uncompressed version is actually very readable:</p>
<p><img class="alignnone size-full wp-image-1244" title="That's better" src="http://netlumination.com/wp-content/uploads/2010/06/readable.jpg" alt="Readable JQuery" width="423" height="352" /></p>
]]></content:encoded>
			<wfw:commentRss>http://netlumination.com/blog/jquery-for-a-little-night-time-reading/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The joys of toxic asset ownership</title>
		<link>http://netlumination.com/blog/the-joys-of-toxic-asset-ownership</link>
		<comments>http://netlumination.com/blog/the-joys-of-toxic-asset-ownership#comments</comments>
		<pubDate>Fri, 11 Jun 2010 21:36:48 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Zany]]></category>
		<category><![CDATA[economics]]></category>
		<category><![CDATA[Planet Money]]></category>
		<category><![CDATA[real estate]]></category>
		<category><![CDATA[toxic assets]]></category>

		<guid isPermaLink="false">http://netlumination.com/?p=1232</guid>
		<description><![CDATA[I tend to listen to a lot of podcasts while doing housework. Listening to things like Planet Money makes washing the dishes fun&#8230; well, maybe not, but it makes it feel like I&#8217;m learning something new while doing the same old same old. Not too long ago, the members of Planet Money pitched in, pooled [...]]]></description>
			<content:encoded><![CDATA[<p>I tend to listen to a lot of podcasts while doing housework. Listening to things like <a href="http://www.npr.org/blogs/money/">Planet Money</a> makes washing the dishes fun&#8230; well, maybe not, but it makes it feel like I&#8217;m learning something new while doing the same old same old.<span id="more-1232"></span></p>
<p>Not too long ago, the members of Planet Money pitched in, pooled their money, and bought their own $1,000&#8242;s worth of real estate based toxic assets. You can hear about how <a href="http://www.npr.org/templates/story/story.php?storyId=124587240">they picked their asset, bought it, and how it&#8217;s doing</a>. You can also hear about the types of things that affect whether the Planet Money team will get a good return on their investment&#8230;. It turns out, that having people not pay their monthly mortgage is ok, since the person who gave out the mortgage is then responsible for paying the money into the toxic asset coffers&#8230; whoever, if the home owners refinance, then the amount of money they have to pay decreases, and so the pay out to the toxic asset decreases. There&#8217;s also all sorts of other stories about the history of their specific toxic asset including <a href="http://www.npr.org/templates/story/story.php?storyId=124578382">an eye opening animated graphic showing the rate that the loans in the asset are going into delinquency</a>. (I do have to say that one of the downfalls of the graphic is that the number of loans in each state is not immediately apparent, even though these numbers vary from one to several thousand&#8230; so make sure you hover over the states you think are interesting to check the sample size).</p>
<p>It&#8217;s a great series of stories, and it lets you understand about toxic assets, and even makes you feel bad for Toxy&#8230;. Yes, Toxy is the name of the toxic asset. But seriously, this is some reporting that takes a subject that is often presented as dead boring and overly complicated, and Planet Money makes the subject personal, interesting, and entertaining. Just wanted to share.</p>
]]></content:encoded>
			<wfw:commentRss>http://netlumination.com/blog/the-joys-of-toxic-asset-ownership/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Three Steps for Using JQuery in Your WordPress Theme</title>
		<link>http://netlumination.com/blog/three-steps-for-using-jquery-in-your-wordpress-theme</link>
		<comments>http://netlumination.com/blog/three-steps-for-using-jquery-in-your-wordpress-theme#comments</comments>
		<pubDate>Mon, 31 May 2010 05:58:39 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[cms]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[theme]]></category>

		<guid isPermaLink="false">http://netlumination.com/?p=1202</guid>
		<description><![CDATA[This is a quick post on using Javascript and the JQuery framework in particular within your WordPress theme. It&#8217;s quick and pretty painless. This is just for regular themes, not admin themes, plugins, or posts. Step 1: Load JQuery and your custom JS onto your page with wp_enqueue_script(). It&#8217;s better to use wp_enqueue_script than hard [...]]]></description>
			<content:encoded><![CDATA[<p>This is a quick post on using Javascript and the JQuery framework in particular within your WordPress theme. It&#8217;s quick and pretty painless. This is just for regular themes, not admin themes, plugins, or posts.</p>
<p><strong>Step 1:</strong></p>
<p><strong><span id="more-1202"></span></strong></p>
<p>Load JQuery and your custom JS onto your page with wp_enqueue_script(). It&#8217;s better to use wp_enqueue_script than hard coding it into your page. This is because WordPress comes with JQuery, so you won&#8217;t have to worry about updating JQuery as new versions come out. WordPress will do the work for you.  Make sure wp_enqueue script is before wp_head(), or it won&#8217;t work.</p>
<p>Here&#8217;s a snippet from my template file (let&#8217;s say index.php). I&#8217;ve created my custom JQuery functions in my themes &#8220;scripts&#8221; directory with the file name &#8220;custom-js.js&#8221;. You also have to make up a handle or name for your collection of custom JQuery functions. I called mine custom:</p>
<ol>
<li>
<pre>&lt;?php</pre>
</li>
<li>
<pre>    wp_enqueue_script('jquery');</pre>
</li>
<li>
<pre>    wp_enqueue_script('custom', get_bloginfo('stylesheet_directory') . '/scripts/custom-js.js');</pre>
</li>
<li>
<pre>    wp_head(); // WP API Hook</pre>
</li>
<li>
<pre>?&gt;</pre>
</li>
</ol>
<p>get_bloginfo is your friend. If you hard code your themes directory into your code anywhere, you won&#8217;t be able to share it with others, and you&#8217;ll break everything if you ever move hosts or just directories.</p>
<p>Here&#8217;s another example. Let&#8217;s say you want to use <a href="http://code.google.com/apis/maps/documentation/javascript/examples/index.html">Google Maps</a> on your page. Here is the line of WP code that makes that possible:</p>
<ol>
<li>
<pre>&lt;?php</pre>
</li>
<li>
<pre>    wp_enqueue_script('googleMaps', 'http://maps.google.com/maps/api/js?sensor=false');  </pre>
</li>
<li>
<pre>?&gt;</pre>
</li>
</ol>
<p>Finally, if you just want plain JS with no JQuery, you can simply leave out the line that calls JQuery but leave in the line that enqueues your custom functions. WordPress comes with a lot of other JS goodies besides JQuery. Scroll down to<a href="http://codex.wordpress.org/Function_Reference/wp_enqueue_script"> the bottom of this page</a> to look at all the other stuff included with WordPress.</p>
<p><strong>Step 2:</strong><br />
Write your JQuery. The only thing you have to look out for is that wp_enqueue_script() calls JQuery in no conflict mode. This means that $ will not work as a shortcut for JQuery functions. There are two simple solutions.</p>
<ol>
<li>Define another shortcut for JQuery functions.</li>
<li>Use a wrapper around your JQuery code.</li>
</ol>
<p>Here is how to define a new shortcut for JQuery functions, $j in this case. The script shown is a very effective test to see if you&#8217;ve got JQuery working in your theme. It&#8217;s a little blunt, but it&#8217;s effects are hard to miss.</p>
<ol>
<li>
<pre>var $j = jQuery.noConflict();</pre>
</li>
<li>
<pre>$j(document).ready(function(){</pre>
</li>
<li>
<pre> $j("body").html("Your page is belong to us... just kidding, but you can use JQuery now.");</pre>
</li>
<li>
<pre>});</pre>
</li>
</ol>
<p>Here is how to use a wrapper in order to use the default JQuery shortcut:</p>
<ol>
<li>
<pre>jQuery(document).ready(function($) {</pre>
</li>
<li>
<pre>    $("body").html("Your page is belong to us... just kidding, but you can use JQuery now.");</pre>
</li>
<li>
<pre>});</pre>
</li>
</ol>
<p>Make sure you pay attention to all the curly brackets and parentheses. If the long and multiple parenthetical expressions annoy you, go check out <a href="http://www.cs.cmu.edu/afs/cs/project/theo-11/www/decision-trees.lisp">Lisp</a>.</p>
<p>Anyway, the second method is nice, since it let&#8217;s you use previously written code easily.</p>
<p><strong>Step 3:</strong></p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://netlumination.com/blog/three-steps-for-using-jquery-in-your-wordpress-theme/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Big Button CSS Menu Links</title>
		<link>http://netlumination.com/blog/big-button-css-menu-links</link>
		<comments>http://netlumination.com/blog/big-button-css-menu-links#comments</comments>
		<pubDate>Sun, 30 May 2010 01:08:54 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[highlight]]></category>
		<category><![CDATA[hover]]></category>
		<category><![CDATA[menu]]></category>

		<guid isPermaLink="false">http://netlumination.com/?p=1147</guid>
		<description><![CDATA[This post will show you how to make this: Home Gnome Rome Notice that the entire highlighted area is clickable, not just the lettering. I&#8217;ll describe a simple way to make pure CSS menu links that highlight nicely when hovered over. Now, you can obviously get a lot fancier with Javascript, but a good website [...]]]></description>
			<content:encoded><![CDATA[<p>This post will show you how to make this:</p>
<div id="da-body4">
<ul id="da-menu4">
<li><a href="http://peter-ajtai.com/examples/html/menu-good.html">Home</a></li>
<li><a href="http://peter-ajtai.com/examples/html/menu-good.html">Gnome</a></li>
<li><a href="http://peter-ajtai.com/examples/html/menu-good.html">Rome</a></li>
</ul>
</div>
<p>Notice that the entire highlighted area is clickable, not just the lettering.<span id="more-1147"></span></p>
<p>I&#8217;ll describe a simple way to make pure CSS menu links that highlight nicely when hovered over. Now, you can obviously get a lot fancier with Javascript, but a good website design degrades nicely. This means that you should stack as much functionality into the (X)HTML and CSS as you can, and then add extras on with Javascript. This will enable you to read the page nicely through the widest range of media. This is important these days when you don&#8217;t know whether your visitors are using a cell phone, iPAD, curl on a UNIX shell, text reader for the vision impaired, or whatever. There are obviously some things Javascript is great for, but there&#8217;s no need to kill a fly with an elephant gun. Don&#8217;t use it when you don&#8217;t have to.</p>
<p>The <a href="http://www.w3.org/">W3C</a> page has a nice example of elegant page degradation when Javascript is turned off. The menu links on the left hand side of the page, for example the ones under standards, flash dark gray before settling to light gray when hovered over. The flash is Javascript. When you <a href="http://noscript.net/">turn Javascript off</a>, notice that the flash is gone, but the links are still highlighted in the same way. You can click anywhere in the Menu box to follow the link, not just over the lettering, and the entire menu box is highlighted in light gray.</p>
<p>Ok let&#8217;s build a similar but simpler vertical menu. Horizontal menus are easier to highlight, since the horizontal width of each box can vary without having the menu look unnatural.</p>
<p>Our menu will have three items: Home, Gnome, and Rome. It often makes sense to put your menu items in an unordered list, so we&#8217;ll do that, and we&#8217;ll set a fixed with for the items. We&#8217;ll use a 440 px body width and 220px menu width, just so you can easily see the results as displayed in this blog.</p>
<p>Ok, let&#8217;s set up the menu with simple highlighting using &#8220;a:hover&#8221;.</p>
<div id="da-body">
<ul id="da-menu">
<li><a href="http://peter-ajtai.com/examples/html/menu-bad.html"> Home</a></li>
<li><a href="http://peter-ajtai.com/examples/html/menu-bad.html"> Gnome</a></li>
<li><a href="http://peter-ajtai.com/examples/html/menu-bad.html"> Rome</a></li>
</ul>
</div>
<p>You can take a look at the menu above <a href="http://peter-ajtai.com/examples/html/menu1.html">on its own page</a>. Here is what that code looks like (remember to use style sheets; I used a style definition in head, so that all the code could be read easily in one go, but unless you like to individually and tediously change CSS rules one at a time for hundreds or thousands of pages, you&#8217;d better use external style sheets):</p>
<p><a href="http://peter-ajtai.com/examples/html/menu-bad.html">Bad Hover Menu</a></p>
<ol>
<li>
<pre>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;</pre>
</li>
<li>
<pre>&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;</pre>
</li>
<li>
<pre>    &lt;head&gt;</pre>
</li>
<li>
<pre>	&lt;style type="text/css"&gt;</pre>
</li>
<li>
<pre>	    #da-body {</pre>
</li>
<li>
<pre>	        background-color:#A6734A;</pre>
</li>
<li>
<pre>	        width:440px;</pre>
</li>
<li>
<pre>	    }</pre>
</li>
<li>
<pre>	    #da-menu {</pre>
</li>
<li>
<pre>		list-style-type:none;</pre>
</li>
<li>
<pre>		width:220px;</pre>
</li>
<li>
<pre>	    }</pre>
</li>
<li>
<pre>	    div#da-body ul#da-menu li a {</pre>
</li>
<li>
<pre>		font-size:180%;</pre>
</li>
<li>
<pre>		line-height:220%;</pre>
</li>
<li>
<pre>		color:#FAEAF3;</pre>
</li>
<li>
<pre>	        text-decoration:none;</pre>
</li>
<li>
<pre>	    }</pre>
</li>
<li>
<pre>	    div#da-body ul#da-menu li a:hover {</pre>
</li>
<li>
<pre>		background-color:#BFB6AF;</pre>
</li>
<li>
<pre>	    }</pre>
</li>
<li>
<pre>	&lt;/style&gt;</pre>
</li>
<li>
<pre>    &lt;/head&gt;</pre>
</li>
<li>
<pre>    &lt;body&gt;</pre>
</li>
<li>
<pre>	&lt;div id="da-body"&gt;</pre>
</li>
<li>
<pre>	    &lt;ul id="da-menu"&gt;</pre>
</li>
<li>
<pre>		&lt;li&gt;&lt;a href="#"&gt;Home&lt;/a&gt;&lt;/li&gt;</pre>
</li>
<li>
<pre>		&lt;li&gt;&lt;a href="#"&gt;Gnome&lt;/a&gt;&lt;/li&gt;</pre>
</li>
<li>
<pre>		&lt;li&gt;&lt;a href="#"&gt;Rome&lt;/a&gt;&lt;/li&gt;</pre>
</li>
<li>
<pre>	    &lt;/ul&gt;</pre>
</li>
<li>
<pre>	&lt;/div&gt;</pre>
</li>
<li>
<pre>    &lt;/body&gt;</pre>
</li>
<li>
<pre>&lt;/html&gt;</pre>
</li>
</ol>
<p>If you hover over a link, the background changes in color. Yeah, but it&#8217;s not very elegant, since the area that&#8217;s highlighted has a different shape for each link. Additionally, you have to be pretty precise with you mouse. The list takes up half the colored area, but you have to hover directly over letters in order to follow a link. Let&#8217;s deal with the first problem first.</p>
<p>It turns out that :hover is a valid pseudo class for a list item not just a. So if we change the a:hover code to li:hove like this:</p>
<ol>
<li>
<pre>div#da-body2 ul#da-menu2 li:hover {</pre>
</li>
<li>
<pre>    background-color:#BFB6AF;</pre>
</li>
<li>
<pre>}</pre>
</li>
</ol>
<p>We&#8217;ll see this:</p>
<div id="da-body2">
<ul id="da-menu2">
<li><a href="http://peter-ajtai.com/examples/html/menu-blah.html"> Home</a></li>
<li><a href="http://peter-ajtai.com/examples/html/menu-blah.html"> Gnome</a></li>
<li><a href="http://peter-ajtai.com/examples/html/menu-blah.html"> Rome</a></li>
</ul>
</div>
<p>Now we&#8217;re getting close. The problem is that you cannot click the entire highlighted area to follow the link. This is because we&#8217;re highlighting the li element and not the a element. Ok, well how about:</p>
<ol>
<li>
<pre>/* THIS WILL NOT WORK!!! */</pre>
</li>
<li>
<pre>div#da-body2 ul#da-menu2 a {</pre>
</li>
<li>
<pre>    width:100%</pre>
</li>
<li>
<pre>}</pre>
</li>
<li>
<pre>div#da-body2 ul#da-menu2 a:hover {</pre>
</li>
<li>
<pre>    background-color:#BFB6AF;</pre>
</li>
<li>
<pre>}</pre>
</li>
<li>
<pre>/* ^^ INCORRECT */</pre>
</li>
</ol>
<p>Nope, that&#8217;ll basically just look like the first example. The problem is that the &#8220;a&#8221; element cannot have a width attribute. It&#8217;s not a block level element. You can&#8217;t set it&#8217;s width normally.</p>
<p>Don&#8217;t you wish we could simply display the anchor element like a block item, in this case like a list item, and then we could set its width. Well, CSS knows about inheritance, and there is a display attribute. We just have to force the &#8220;a&#8221; or anchor tag to act different than usual using, &#8220;display:inherit;&#8221;. This means that the &#8220;a&#8221; tag will inherit whatever display mode its parent element has. In this case it will will inherit the &#8220;block&#8221; display from the li element. So, our solution is:</p>
<ol>
<li>
<pre>div#da-body ul#da-menu a {</pre>
</li>
<li>
<pre>    display:inherit;</pre>
</li>
<li>
<pre>    width:100%</pre>
</li>
<li>
<pre>}</pre>
</li>
<li>
<pre>div#da-body ul#da-menu a:hover {</pre>
</li>
<li>
<pre>    background-color:#BFB6AF;</pre>
</li>
<li>
<pre>}</pre>
</li>
</ol>
<p>This will produce:</p>
<div id="da-body3">
<ul id="da-menu3">
<li><a href="http://peter-ajtai.com/examples/html/menu-good.html">Home</a></li>
<li><a href="http://peter-ajtai.com/examples/html/menu-good.html">Gnome</a></li>
<li><a href="http://peter-ajtai.com/examples/html/menu-good.html">Rome</a></li>
</ul>
</div>
<p>Incidentally, &#8220;display:block&#8221; will work too. To wrap up, here is the full code:</p>
<p><a href="http://peter-ajtai.com/examples/html/menu-good.html">Good Hover Menu</a>:</p>
<ol>
<li>
<pre>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;</pre>
</li>
<li>
<pre>&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;</pre>
</li>
<li>
<pre>    &lt;head&gt;</pre>
</li>
<li>
<pre>        &lt;style type="text/css"&gt;</pre>
</li>
<li>
<pre>            #page {</pre>
</li>
<li>
<pre>                background-color:#A6734A;</pre>
</li>
<li>
<pre>                width:440px;</pre>
</li>
<li>
<pre>            }</pre>
</li>
<li>
<pre>            #menu {</pre>
</li>
<li>
<pre>                list-style-type:none;</pre>
</li>
<li>
<pre>                width:220px;</pre>
</li>
<li>
<pre>                padding:0;</pre>
</li>
<li>
<pre>                margin:0;</pre>
</li>
<li>
<pre>            }</pre>
</li>
<li>
<pre>            div#page ul#menu li {</pre>
</li>
<li>
<pre>                padding:0;</pre>
</li>
<li>
<pre>                margin:0;</pre>
</li>
<li>
<pre>            }</pre>
</li>
<li>
<pre>            div#page ul#menu li a {</pre>
</li>
<li>
<pre>                display:inherit;</pre>
</li>
<li>
<pre>                width:100%;</pre>
</li>
<li>
<pre>                font-size:180%;</pre>
</li>
<li>
<pre>                line-height:220%;</pre>
</li>
<li>
<pre>                color:#FAEAF3;</pre>
</li>
<li>
<pre>                text-decoration:none;</pre>
</li>
<li>
<pre>                text-indent:0.5em;</pre>
</li>
<li>
<pre>            }</pre>
</li>
<li>
<pre>            div#page ul#menu li a:hover {</pre>
</li>
<li>
<pre>                background-color:#BFB6AF;</pre>
</li>
<li>
<pre>            }</pre>
</li>
<li>
<pre>        &lt;/style&gt;</pre>
</li>
<li>
<pre>    &lt;/head&gt;</pre>
</li>
<li>
<pre>    &lt;body&gt;</pre>
</li>
<li>
<pre>        &lt;div id="page"&gt;</pre>
</li>
<li>
<pre>            &lt;ul id="menu"&gt;</pre>
</li>
<li>
<pre>                &lt;li&gt;&lt;a href="#"&gt;Home&lt;/a&gt;&lt;/li&gt;</pre>
</li>
<li>
<pre>                &lt;li&gt;&lt;a href="#"&gt;Gnome&lt;/a&gt;&lt;/li&gt;</pre>
</li>
<li>
<pre>                &lt;li&gt;&lt;a href="#"&gt;Rome&lt;/a&gt;&lt;/li&gt;</pre>
</li>
<li>
<pre>            &lt;/ul&gt;</pre>
</li>
<li>
<pre>        &lt;/div&gt;</pre>
</li>
<li>
<pre>    &lt;/body&gt;</pre>
</li>
<li>
<pre>&lt;/html&gt;</pre>
</li>
</ol>
<p>Incidentally, you can see that I&#8217;ve got a few margin:0s and padding:0s thrown in to make things look neater. Instead of dealing with zeroing the margins, paddings, etc. for each item one by one, you can simply use a <a href="http://meyerweb.com/eric/tools/css/reset/">CSS reset</a>. You can put this at the top of your style sheet, or add it in as a separate style sheet. I didn&#8217;t use a CSS reset for this example, since I wanted to keep the code as self contained as possible.</p>
<p>Ok, that&#8217;s all the hovering over CSS menus for today.</p>
]]></content:encoded>
			<wfw:commentRss>http://netlumination.com/blog/big-button-css-menu-links/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating your first WordPress theme &#8211; Part 1</title>
		<link>http://netlumination.com/blog/creating-your-first-wordpress-theme-part-1</link>
		<comments>http://netlumination.com/blog/creating-your-first-wordpress-theme-part-1#comments</comments>
		<pubDate>Wed, 26 May 2010 19:26:46 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[cms]]></category>
		<category><![CDATA[convenience]]></category>

		<guid isPermaLink="false">http://netlumination.com/?p=1041</guid>
		<description><![CDATA[Content Management Systems and WordPress is so powerful because it allows site owners to update their sites efficiently and to customize their sites and their CMS experience. WordPress themes control both the look of a site and the options a site owner has in terms of customizing this look. That sounds pretty good and rather [...]]]></description>
			<content:encoded><![CDATA[<p>Content Management Systems and <a href="http://wordpress.org/">WordPress</a> is so powerful because it allows site owners to update their sites efficiently and to customize their sites and their CMS experience. <a href="http://codex.wordpress.org/Theme_Development">WordPress themes</a> control both the look of a site and the options a site owner has in terms of customizing this look.</p>
<p>That sounds pretty good and rather vague. It&#8217;s hard to describe what you can do with WordPress themes, since they can do a lot. It&#8217;s like trying to describe all the things you can do with a nail. It all depends on how you use it.</p>
<p>In light of this, it seems like the best thing to do would be to go through an example of building a WordPress theme. I&#8217;ll go through a theme as I develop it, and I&#8217;ll try to build it starting at the simplest level and working to progressively more complicated iterations.</p>
<p>Before we begin, there&#8217;s a few things that I&#8217;m going to assume:</p>
<ol>
<li>You&#8217;ve got WordPress installed on your site. <a href="http://codex.wordpress.org/Installing_WordPress">It&#8217;s usually pretty easy to install WordPress</a>.</li>
<li>You can access the files in your WordPress install.</li>
<li>You can access your WordPress admin panel.</li>
</ol>
<p><span id="more-1041"></span></p>
<p>You can usually access your files through FTP, SSH, or even your web host&#8217;s control panel. On Windows I usually use <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/">PuTTY</a> for SSH. I&#8217;ve heard good things about <a href="http://filezilla-project.org/">FileZilla</a> for FTP, but I&#8217;ve personally never tried it. You can edit your files with anything from Notepad (ugh) to <a href="http://notepad-plus.sourceforge.net/uk/site.htm">Notepad++</a> (yay!) to <a href="http://www.adobe.com/products/dreamweaver/">Dreamweaver</a> (for all the flack Dreamweaver gets, it sure can speed up a lot of things), <a href="http://www.gnu.org/software/emacs/tour/">Emacs</a> (hang on, let me grow a beard and put on my glasses)&#8230;</p>
<p>Actually, in spite of the beard and glasses joke, if your host offers a Unix or Linux shell, then working on your pages with Emacs can be a great pleasure. I mean you have access to not just your files, but also to your files through one of the most powerful &#8220;word processors&#8221; in the world. No more worrying about whether your files are on your desktop, laptop, smartphone, or smartbrain. Anyway, Emacs is fun and free (free as in hair, and yanking it out in frustration while you pound your head against the keyboard trying to understand what a <a href="http://www.gnu.org/software/emacs/emacs-lisp-intro/elisp/Lambda-Expressions.html#Lambda-Expressions">Lambda expression</a> is). No, but seriously, using Emacs through SSH courtesy of your web host is fantastic stuff, and lets them work a little for the money you give them. I will shamelessly mention that I use <a href="http://www.dreamhost.com/r.cgi?132190">Dreamhost</a>, and so can you by clicking on that link that will earn me money when you sign up.</p>
<p><script type="text/javascript">// <![CDATA[
 google_ad_client = "pub-4166122661117213"; /* 336x280, created 4/27/09 */ google_ad_slot = "9673694336"; google_ad_width = 336; google_ad_height = 280;
// ]]&gt;</script><br />
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript">
</script></p>
<p>Ok, you&#8217;ve got WordPress installed, and you can access the files on your server. Let&#8217;s start building a theme.</p>
<p>The way WordPress works is that it runs a bunch of PHP create the HTML for your web pages. These PHP pages will often look into an associated MySQL database for info. The PHP will also look (ok, I&#8217;m definitely anthropomorphizing) in specific directories for certain things.</p>
<p>One of these special directories contain all the themes that you have installed. Each theme is in its own folder, and you can pick the theme to use through the WordPress admin panel.</p>
<p>You can find the theme choices on the left side of the adminn panel under &#8220;Appearance&#8221;:</p>
<p><img class="alignnone size-full wp-image-1046" title="Wordpress themes" src="http://netlumination.com/wp-content/uploads/2010/05/wp-011.jpg" alt="Themes through the admin panel" width="244" height="436" /></p>
<p>The directory that the themes you can pick from are in is:</p>
<blockquote><p>/wp-content/themes/</p></blockquote>
<p>Each directory in themes is a theme you can use. Understanding how WordPress knows that the contents of these directories are themes will help us create our first theme.</p>
<p>WordPress looks at the main stylesheet in each directory, and from this style sheet it reads the information about the theme. You have to know that convention that for WordPress the main style sheet is a file called, &#8220;style.css&#8221;. So the simplest theme is just a style sheet in a directory. Let&#8217;s see how to make one of these themes&#8230;</p>
<p>Let&#8217;s look at this in practice. Here&#8217;s is what the themes page looks like when /wp-content/themes only has the Classic theme in it. In other words /wp-content/themes only has a directory named &#8220;classic&#8221; in it, and the index.php file:</p>
<p><img class="alignnone size-full wp-image-1056" title="Classic theme" src="http://netlumination.com/wp-content/uploads/2010/05/wp-021.jpg" alt="Classic theme" width="440" height="239" /></p>
<p>As you can see, I&#8217;m currently redoing <a href="http://www.evergreenicesports.org/">Evergreen Ice Sports</a> web page. Soon it&#8217;ll look nicer and be easier to maintain for the site owners. Anyway, as you can see currently Classic is the only available theme.</p>
<p>If we create a directory with only a style sheet called &#8220;style.css&#8221; in it, we can use that style sheet to:</p>
<ol>
<li>Tell WordPress that the directory the style sheet is in contains a WordPress theme.</li>
<li>Tell WordPress that theme is just like another theme with a few modifications (in other words the theme is a <a href="http://codex.wordpress.org/Child_Themes">child theme</a>).</li>
</ol>
<p>Ok, let&#8217;s step through this and then discuss it. First create a directory called, &#8220;mytheme&#8221; in wp-content/themes . Now reload the Manage Themes page in the admin panel to see what happened:</p>
<p><img class="alignnone size-full wp-image-1057" title="Mytheme" src="http://netlumination.com/wp-content/uploads/2010/05/wp-031.jpg" alt="Broken theme" width="440" height="291" /></p>
<p>This shows you that I was telling the truth about WP looking in the wp-content/themes directory for the available themes. It looked in your empty directory called mythemes, and since it the information about each theme is supposed to be in the main style sheet, and there is no style sheet in mythemes, we have a broken theme.</p>
<p>Let&#8217;s add a stylesheet over at wp-content/themes/mytheme/style.css. This style sheet will contain all the necessary information to create a WordPress theme. Here are all of the contents:</p>
<ol>
<li>
<pre>/*</pre>
</li>
<li>
<pre>Theme Name:     My Theme</pre>
</li>
<li>
<pre>Theme URI:      http: //netlumination.com/</pre>
</li>
<li>
<pre>Description:    Child theme spawned by the Classic theme</pre>
</li>
<li>
<pre>Author:         Peter Ajtai</pre>
</li>
<li>
<pre>Author URI:     http: //peter-ajtai.com/</pre>
</li>
<li>
<pre>Template:       classic</pre>
</li>
<li>
<pre>Version:        1.0</pre>
</li>
<li>
<pre>*/</pre>
</li>
</ol>
<p>Yup, that&#8217;s all it takes, and yeah replace my info with your info, but make sure that line 7 stays untouched. The file contains only CSS comments. WordPress, reads these comments, and when it sees line 7, that says &#8220;Template: default&#8221;, it understands that mytheme is a child theme of the theme that is in the directory called, &#8220;classic&#8221;. Let&#8217;s reload the Themes admin panel and activate this new theme.</p>
<p><img class="alignnone size-full wp-image-1058" title="Our style" src="http://netlumination.com/wp-content/uploads/2010/05/wp-041.jpg" alt="Our style" width="440" height="521" /></p>
<p>You can see how WordPress used the information in the CSS file to fill in the information about our new theme. You&#8217;ll notice that there is no screen shot for My Theme. We&#8217;ll do this soon. Anyway, click on &#8220;activate&#8221; to&#8230;. uh&#8230;.. activate the theme. Since MyTheme is a child of Classic, this means that MyTheme inherits all the characteristics of Classic. We can add to or modify these characteristics, but we haven&#8217;t done that yet, so right now our theme should look identical to Classic. Visit your site&#8217;s homepage to check on this&#8230;&#8230;</p>
<p>Whoops!</p>
<p>Our page looks like it has no styles! I guess I lied. MyTheme inherits everything from Classic <strong><em>except</em></strong> the style sheet. That&#8217;s a little odd right? Especially if you&#8217;re used to dealing with inheritance in things like children and object oriented programming, but no matter, it&#8217;s easier to fix than your&#8230;. well, than, many things. So, let&#8217;s grab the style sheet from the classic theme using the line:</p>
<ol>
<li>
<pre>@import url("../classic/style.css");</pre>
</li>
</ol>
<p>So now our entire wp-content/themes/mytheme/style.css file looks like:</p>
<ol>
<li>
<pre>/*</pre>
</li>
<li>
<pre>Theme Name:     My Theme</pre>
</li>
<li>
<pre>Theme URI:      http: //netlumination.com/</pre>
</li>
<li>
<pre>Description:    Child theme spawned by the Classic theme</pre>
</li>
<li>
<pre>Author:         Peter Ajtai</pre>
</li>
<li>
<pre>Author URI:     http: //peter-ajtai.com/</pre>
</li>
<li>
<pre>Template:       classic</pre>
</li>
<li>
<pre>Version:        1.0</pre>
</li>
<li>
<pre>*/</pre>
</li>
<li>
<pre>@import url("../classic/style.css");</pre>
</li>
</ol>
<p>Ok, now go and check on how your home page looks&#8230;. Just like classic, huh? Well, that&#8217;s not very interesting, let&#8217;s make things a very tiny bit more interesting by adding one more line to prove that we have a theme that uses default but has some of it&#8217;s own rules:</p>
<ol>
<li>
<pre>/*</pre>
</li>
<li>
<pre>Theme Name:     My Theme</pre>
</li>
<li>
<pre>Theme URI:      http: //netlumination.com/</pre>
</li>
<li>
<pre>Description:    Child theme spawned by the Classic theme</pre>
</li>
<li>
<pre>Author:         Peter Ajtai</pre>
</li>
<li>
<pre>Author URI:     http: //peter-ajtai.com/</pre>
</li>
<li>
<pre>Template:       classic</pre>
</li>
<li>
<pre>Version:        1.0</pre>
</li>
<li>
<pre>*/</pre>
</li>
<li>
<pre>@import url("../classic/style.css");</pre>
</li>
<li>
<pre>body {</pre>
</li>
<li>
<pre>	background-color:blue;</pre>
</li>
<li>
<pre>}</pre>
</li>
</ol>
<p>Ok, that was 3 lines, but I could have made it one line. Does it work? Yup. Does it work with all themes&#8230;&#8230; uh, no. For example, if you try the same thing with the Default theme, you&#8217;ll notice that some of the background images that are used in the Default theme will not be used in your child theme. This is because the CSS for these background images are created by PHP that looks for them in the wrong directory. It&#8217;s easy to fix, but it illustrates why I&#8217;m using so many words to explain this one simple thing of how to make a child theme. If you know how all of this works, you can probably track down these problems. If you don&#8217;t know how it works, you&#8217;re lost. But these details aren&#8217;t important right now, since we want to create our own theme, not look for weird little leaks in the inheritance abstraction for WordPress themes.</p>
<p>You&#8217;ve just created your own WP theme! Don&#8217;t worry it gets better. We&#8217;ll do stuff that&#8217;s more useful. We&#8217;ll push pixels around around like they&#8217;re not our boss. We&#8217;ll meld code to our mind&#8217;s desire, but you&#8217;ll have to wait for the next part of this series for that&#8230; until then we&#8217;ll&#8230;.. well, we&#8217;ll see you later.</p>
]]></content:encoded>
			<wfw:commentRss>http://netlumination.com/blog/creating-your-first-wordpress-theme-part-1/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why use a Content Management System</title>
		<link>http://netlumination.com/blog/why-use-a-content-management-system</link>
		<comments>http://netlumination.com/blog/why-use-a-content-management-system#comments</comments>
		<pubDate>Wed, 26 May 2010 05:41:34 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Website Advice]]></category>
		<category><![CDATA[cms]]></category>
		<category><![CDATA[control]]></category>
		<category><![CDATA[convenience]]></category>
		<category><![CDATA[usability]]></category>

		<guid isPermaLink="false">http://netlumination.com/?p=1024</guid>
		<description><![CDATA[You can feel free to skip this entire article if you have a website that you are happy with&#8230; hold on, there&#8217;s something else&#8230; and you can easily update it. Notice that I said you, not your latte drinking, jargon spouting, charge by the hour web air quotes consultant. One of the main reasons to [...]]]></description>
			<content:encoded><![CDATA[<p>You can feel free to skip this entire article if you have a website that you are happy with&#8230; hold on, there&#8217;s something else&#8230; and you can easily update it. Notice that I said you, not your latte drinking, jargon spouting, charge by the hour web air quotes consultant.</p>
<p>One of the main reasons to use a content management system is to enable you to update the content, and sometimes the look of your site. A CMS (I&#8217;ll explain what it is soon) should enable you to do this in a painless way. In other words, without cracking open any sort of O&#8217;Reilly book with &#8220;the Definitive Guide&#8221; somewhere in the title.</p>
<p><span id="more-1024"></span></p>
<p>This brings me back to what exactly is a Content Management System. Sorry, I didn&#8217;t link you to <a href="http://en.wikipedia.org/wiki/Web_content_management_system">this Wikipedia page</a> because it&#8217;s not all that helpful. In broad terms a CMS lets you have control of your website without having to understand all the code that makes it work. Of course there are many different CMSes, and some are better at this than others. But basically a CMS is like the controls on your car. The controls on your car let you drive a car without having to understand how an engine works. Now, some cars are better at doing this than others. If you&#8217;ve got a Fiat with 300,000 miles on it, then you don&#8217;t get into the car without your tool box right? But if you&#8217;ve got a new Honda you may not even know where the lever to open the hood is. Basically, sometimes you&#8217;re going to have to deal with the innards of your car or your web site, but hopefully <a href="http://www.joelonsoftware.com/articles/LeakyAbstractions.html">not often</a>.</p>
<p>Sounds good right? You don&#8217;t want to drive a car and get oil on your hands, and you don&#8217;t want to make a website and get ones and zeros on your hands&#8230;. or those &lt; and &gt; symbols or whatever. Now you just have to pick a CMS. I&#8217;ll jump the gun here and tell you that <a href="http://wordpress.org/">WordPress</a> is often a good choice.</p>
<p>But you&#8217;ve got plenty of other choices, some free (as in beard (or leg hair), beer, or fall depending on what you pick): <a href="http://www.concrete5.org/">Concrete5</a>, <a href="http://drupal.org/">Drupal</a>, <a href="http://www.joomla.org/">Joomla</a>, <a href="http://wordpress.org/">WordPress</a>&#8230; and some for payment (as in investment or hole in your computer screen you stuff money into that will be lost forever depending on what you pick): <a href="http://www.fogcreek.com/CityDesk/">City Desk</a>, <a href="http://expressionengine.com/">Expression Engine</a>, <a href="http://sharepoint.microsoft.com/en-us/Pages/default.aspx">Sharepoint</a>, <a href="http://www.sitefinity.com/">Sitefinity</a>&#8230;</p>
<p>I like WordPress for small business sites. It&#8217;s pretty easy to use, very flexible, open source, and built from <a href="http://www.php.net/">PHP</a> and <a href="http://www.mysql.com/">MySQL</a> which are also open source. Like I said, there&#8217;s plenty of other choices, many of them excellent.</p>
<p>Ok, so where was I? Something about Fiats and oil on your hands. Time for <a href="http://www.cartalk.com/">Car Talk</a>? Wait, I was talking about Content Management Systems and why they help you not to get your hands dirty.</p>
<p>So, a CMS puts the power back into the user&#8217;s hands. Admittedly even a CMS has a learning curve, and sometimes you will run into things that you need to dive into the &lt;!DOCTYPE&#8230; for. But this is why you have time and money. Oh you don&#8217;t, well, what it comes down to is that you&#8217;ll use less of both with a CMS.</p>
<p>Here&#8217;s a concrete example. It&#8217;s a very simple one. Let&#8217;s say you have a web page, and it&#8217;s about food. You care about food. You don&#8217;t care too much about clunky computer code. You&#8217;ve got all sorts of stuff on your webpage including some of the dishes you create for your clients. You&#8217;ve just made a new dish you&#8217;re very proud of, and you want to put it on your website. Now, at first you might say that it should be easy. You can figure out how to modify the page on the server. Well maybe, but since you have a nice site, it&#8217;s not just one page. Each recipe is filed under one or more food categories. Each recipe has a pretty background. Some of the recipes may be highlighted in special sections. Basically, it&#8217;ll take a long time for you to figure out how to add just one recipe to your site. You&#8217;ll have to update a lot of things, and you&#8217;ll probably break your site a few times before you succeed. Granted, you&#8217;ll learn a lot about HTML, Javascript, PHP, MySQL, Apache, and who know what else, but you don&#8217;t care about that, you care about food.</p>
<p>A CMS handles these type of things for you. How? Well, by creating a bunch of control panels that let you add to, subtract from, and modify your site.</p>
<p>Don&#8217;t worry even if you have a CMS, you&#8217;ll still be able to throw plenty of money at your latte drinking, jargon spouting, charge by the hour web air quotes consultant&#8230; but you&#8217;ll be able to do it while having control over your own site. In fact, the hope is that the more work you get done on tweaking your CMS to fit your needs, the more control you&#8217;ll have, so all that money becomes a good investment, not just lattes down the drain.</p>
]]></content:encoded>
			<wfw:commentRss>http://netlumination.com/blog/why-use-a-content-management-system/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
