<?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>U-notez &#187; Programming</title>
	<atom:link href="http://www.unitz.com/u-notez/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.unitz.com/u-notez</link>
	<description>Web development tips, ideas and discoveries from Unitz LLC</description>
	<lastBuildDate>Mon, 16 Aug 2010 18:41:04 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>A Cufón Small Caps Hack</title>
		<link>http://www.unitz.com/u-notez/2010/06/a-cufon-small-caps-hack/</link>
		<comments>http://www.unitz.com/u-notez/2010/06/a-cufon-small-caps-hack/#comments</comments>
		<pubDate>Thu, 03 Jun 2010 04:13:37 +0000</pubDate>
		<dc:creator>Paul Reilly</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[User interfaces]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[cufon]]></category>
		<category><![CDATA[cufón small-caps]]></category>
		<category><![CDATA[font replacement]]></category>
		<category><![CDATA[small caps]]></category>

		<guid isPermaLink="false">http://www.unitz.com/u-notez/?p=252</guid>
		<description><![CDATA[I love the cufón font replacement technique. It allows developers to use custom fonts dynamically in their websites.  It&#8217;s incredibly easy to use compared to earlier options like siFR.  The@font-face CSS3 property (and Google Font Directory!) are  of course an even better solution, but the limited browser support means  we&#8217;ll have to wait [...]]]></description>
			<content:encoded><![CDATA[<p>I love the <a href="http://cufon.shoqolate.com/generate/" target="_blank">cufón </a>font replacement technique. It allows developers to use custom fonts dynamically in their websites.  It&#8217;s incredibly easy to use compared to earlier options like siFR.  The@font-face CSS3 property (and <a href="http://code.google.com/webfonts" target="_blank">Google Font Directory</a>!) are  of course an even better solution, but the limited browser support means  we&#8217;ll have to wait awhile before this approach has dominance. For now, Cufón is easy enough and works in just about <a href="http://wiki.github.com/sorccu/cufon/" target="_blank">every browser</a> &#8211; even IE6!</p>
<p><span id="more-252"></span></p>
<p>I&#8217;ve used this approach recently for several sites with dynamic page titles with great success.  That doesn&#8217;t mean it still has some <a href="http://wiki.github.com/sorccu/cufon/known-bugs-and-issues" target="_blank">limitations</a>. The two biggest in my opinion are the inability to select the replaced text, and the lack of a reliable hover option (so you can change the replaced font color on mouse-over). Another issue that has affected me is the lack of small-caps support. Although it&#8217;s slated to be included in a future Cufon version, I hacked together an approach that works now using jQuery and JavaScript regular expressions.</p>
<p>The process is fairly simple &#8211; first replace your text with Cufón, then run a regular expression that inserts SPAN tags around the first letter of each word, and then use jQuery to increase the font size of these span&#8217;s classes. Simply setting the classes font-size larger in CSS before hand does not work.</p>
<p>Below you can see the three stages of the process that I went through &#8211; first I loaded up a headline that uses the CSS small caps attribute &#8211; it works but it&#8217;s not the font I want. The next headline is Cufon replaced &#8211; it looks much better, but I&#8217;ve lost the small caps effect. Finally using the hack, I&#8217;ve achieved the custom font with small caps.</p>
<p><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script><script type="text/javascript" src="http://www.unitz.com/u-notez/wp-content/uploads/2010/06/cufon-yui.js"></script><script type="text/javascript" src="http://www.unitz.com/u-notez/wp-content/uploads/2010/06/agp_400.font_.js"></script></p>
<style type="text/css">h1.post {
font-family:times,times new roman, serif;
font-size:20px;
font-variant:small-caps;
color:#900;
}h1#test3 {
text-transform:uppercase;
}h1 span.caps {
	position:relative;
	top:2px;	
}</style>
<p><script type="text/javascript">jQuery(document).ready(function($) {
	Cufon.replace('h1#test2', { fontFamily: 'agp' });
	var text = $('h1#test2').html();
	$('h1#post2').html(text.replace(/\b([A-Za-z0-9])/g,'<span class="caps">$1</span>'));
	Cufon.replace('h1#test3', { fontFamily: 'agp' });
	var text = $('h1#test3').html();
	$('h1#test3').html(text.replace(/\b([A-Za-z0-9])/g,'<span class="caps">$1</span>'));
	$('.caps').css('font-size',30);});</script></p>
<h1 class="post" id="test1">Un-replaced Text with Small Caps</h1>
<h1 class="post" id="test2">Replaced Text before Small Caps Hack</h1>
<h1 class="post" id="test3">Replaced Text with Small Caps</h1>
<p>The first step is to load in your various javascript files. You can download cufon and create your own font javascript files at <a href="http://cufon.shoqolate.com" target="_blank">cufon.shoqolate.com</a>.</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;PATHTO/cufon-yui.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;PATHTO/font-file-you-create.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span></pre></div></div>

<p>Then you can set up the styles you want your headlines to have:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">&lt;style type<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span><span style="color: #00AA00;">&gt;</span>
h1 <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #3333ff;">:times</span><span style="color: #00AA00;">,</span>times new roman<span style="color: #00AA00;">,</span> <span style="color: #993333;">serif</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span><span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">text-transform</span><span style="color: #00AA00;">:</span><span style="color: #993333;">uppercase</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#900</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&lt;/style<span style="color: #00AA00;">&gt;</span></pre></div></div>

<p>The next step is to create your headline:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h1</span>&gt;</span>This is the headline I'm font-replacing<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h1</span>&gt;</span></pre></div></div>

<p>Finally, use the follow JavaScript to create the effect:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">jQuery<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	Cufon.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'h1'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> text <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'h1'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'h1'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span>text.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/\b([A-Za-z0-9])/g</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'&lt;span class=&quot;caps&quot;&gt;$1&lt;/span&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.caps'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'font-size'</span><span style="color: #339933;">,</span><span style="color: #CC0000;">30</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>This script, which loads when the DOM is ready, first replaces the font, then inserts &lt;span class=&#8221;caps&#8221;&gt; around the first letter of each word, and finally increases the font size on these first letters from 20px to 30px. You can of course change these font sizes to meet your needs. The particular font I used here, Adobe Garamond Pro, had a slight line-height offset after this JavaScript was run &#8211; I fixed this with a style for the &#8216;caps&#8217; CSS class &#8211; you may need something similar for the font you choose</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">h1 span<span style="color: #6666ff;">.caps</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span><span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span><span style="color: #933;">2px</span><span style="color: #00AA00;">;</span>	
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>I hope someone finds this useful.</p>
<iframe class="me-likey" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.unitz.com%2Fu-notez%2F2010%2F06%2Fa-cufon-small-caps-hack%2F&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;height=80&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:80px"></iframe>]]></content:encoded>
			<wfw:commentRss>http://www.unitz.com/u-notez/2010/06/a-cufon-small-caps-hack/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Using the WordPress 3.0 Menus Feature Part 2 &#8211; Styling and Animating</title>
		<link>http://www.unitz.com/u-notez/2010/05/how-to-style-animate-wordpress-3-menus/</link>
		<comments>http://www.unitz.com/u-notez/2010/05/how-to-style-animate-wordpress-3-menus/#comments</comments>
		<pubDate>Mon, 31 May 2010 12:45:51 +0000</pubDate>
		<dc:creator>Paul Reilly</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[User interfaces]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.unitz.com/u-notez/?p=216</guid>
		<description><![CDATA[Welcome back! Since my first post, where I demonstrated the simple yet powerful WordPress 3.0 Menu Management functionality, WordPress 3.0 RC1 has been released! With this great new tool, WordPress has become an even more robust option for content management. Now non-technical users can easily manage the navigation (including drop-down menus) of their site through [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.unitz.com/u-notez/wp-content/uploads/2010/05/images.jpg" alt="" title="images" width="118" height="118" class="alignright size-full wp-image-194" />Welcome back! Since my <a href="http://www.unitz.com/u-notez/2010/05/how-to-use-the-wordpress-3-menus-feature/" target="_blank">first post</a>, where I demonstrated the simple yet powerful <a href="http://codex.wordpress.org/Function_Reference/wp_nav_menu" target="_blank">WordPress 3.0 Menu Management</a> functionality, <a href="http://wordpress.org/development/2010/05/wordpress-3-0-release-candidate/" target="_blank">WordPress 3.0 RC1</a> has been released! With this great new tool, WordPress has become an even more robust option for content management. Now non-technical users can easily manage the navigation (including drop-down menus) of their site through a WYSIWYG environment.</p>
<p>In this second post, I&#8217;m going to explore the code generated by this functionality, and give a simple demonstration of how to style and animate the generated menus using  CSS and <a href="http://www.jquery.com" target="_blank">jQuery</a>. You can then use these skills to develop your own WordPress 3.0 theme and its menus.</p>
<p><span id="more-216"></span></p>
<p>Here&#8217;s a demonstration video of the end result. The menus were created using the WordPress Menu Management functionality and are set to animate down and fade in on mouseover, and utilize CSS3 gradients and rounded corners. Refer back to <a href="http://www.unitz.com/u-notez/2010/05/how-to-use-the-wordpress-3-menus-feature/" target="_blank">part I</a> to see how the menus were created initially.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="675" height="481" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=12117988&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed type="application/x-shockwave-flash" width="675" height="481" src="http://vimeo.com/moogaloop.swf?clip_id=12117988&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>Our first step will be to add styling to the menus. As with the previous post, I am basing these instructions on the default WordPress 3.0 Theme &#8220;Twenty Ten.&#8221; It&#8217;s important to understand all of the pieces of code that come together to draw the menus. For this example, 3 files will come into play.</p>
<p>The first is header.php in the theme&#8217;s root directly. This is the file that draws the header part of your pages. In the Twenty Ten theme, it includes a call to wp_nav_menu(). This is the function that queries WordPress for the menu in HTML. It takes several optional parameters, which I won&#8217;t get into here &#8211; they&#8217;re described at <a href="http://codex.wordpress.org/Function_Reference/wp_nav_menu" target="_blank">http://codex.wordpress.org/Function_Reference/wp_nav_menu</a> if you&#8217;d like to explore &#8211; they let you change CSS classes, wrapper &lt;DIV&gt;s, etc.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;div id=&quot;access&quot;&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> wp_nav_menu<span style="color: #009900;">&#40;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'sort_column'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'menu_order'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'container_class'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'menu-header'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'theme_location'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'primary'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;/div&gt;</pre></div></div>

<p>Sample output of this function is below. You&#8217;ll notice that WordPress draws the menu out using unordered lists. They nest secondary menus in additional &lt;ul&gt; tags. This is a very popular method to organize navigation and is highly customizable with CSS. If you&#8217;re unfamiliar with this approach, <a href="http://www.alistapart.com/articles/horizdropdowns/" target="_blank">A List Apart</a> has a very good explanation.</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;access&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-header&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-wordpress-sandbox-menu&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-item-17&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-item&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Fruits<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;sub-menu&quot;</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-item-19&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-item&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Oranges<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-item-20&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-item&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Apples<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-item-32&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-item&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Colors<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;sub-menu&quot;</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-item-30&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-item&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Blue<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-item-31&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-item&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Red<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-item-33&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-item&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Links<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;sub-menu&quot;</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-item-34&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-item&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Google<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-item-35&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-item&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Yahoo!<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<p>Comparing this HTML output to the accompanying sample images and video, you&#8217;ll notice the drop-down portion of the navigation is in the nested &lt;UL&gt;s with a CSS class of &#8217;sub-menu&#8217;.  This is generated automatically by WordPress and this nesting structure is how you can add style and animation. Please note that for this demonstration, the HTML above has been simplified &#8211; my links are empty and I have also stripped out many additional class names that WordPress includes automatically for the UL&#8217;s and LI&#8217;s to make the HTML simpler to read. These classes can be very useful for detailed styling though, so consider reviewing your generated code when you do your implementation.</p>
<p>Now that we know how the menus are drawn in HTML, we can start to style and animate them. As mentioned earlier, my examples work on top of the Twenty Ten default WordPress 3.0 Theme, so I will show code from this theme. This theme has a GNU General Public License so we&#8217;re free to modify it and use it near any way we&#8217;d like &#8211; consider copying it and working on the copied version for your experimentation. </p>
<p>The CSS styles for the Twenty Ten theme are in the file styles.css in the main theme directory. Starting around line 370 of this file (in the RC1 version of WordPress at least), you&#8217;ll see a section of the CSS commented &#8216;Menu&#8217; that starts defining the menu&#8217;s styles.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/* =Menu
-------------------------------------------------------------- */</span>
<span style="color: #cc00cc;">#access</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#000</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span> <span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">940px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span><span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Looking through this section of CSS, you&#8217;ll see the various styles that set the colors and fonts used in the menus. In my example, I changed the background colors for the nested sub-menu lists. I also added gradients to them (these gradients only work on CSS3 compatible browsers). Specifically I styled &#8220;#access ul ul a&#8221; like so (the background-image calls set the gradient):</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#access</span> ul ul a <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#333</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">line-height</span><span style="color: #00AA00;">:</span><span style="color: #933;">1em</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span><span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">160px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background-image</span><span style="color: #00AA00;">:</span> -moz-linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #933;"><span style="color: #cc66cc;">100</span>%</span> <span style="color: #933;"><span style="color: #cc66cc;">100</span>%</span> 90deg<span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#474747</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#939393</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background-image</span><span style="color: #00AA00;">:</span> -webkit-gradient<span style="color: #00AA00;">&#40;</span>linear<span style="color: #00AA00;">,</span> <span style="color: #933;"><span style="color: #cc66cc;">0</span>%</span> <span style="color: #933;"><span style="color: #cc66cc;">0</span>%</span><span style="color: #00AA00;">,</span> <span style="color: #933;"><span style="color: #cc66cc;">0</span>%</span> <span style="color: #933;"><span style="color: #cc66cc;">100</span>%</span><span style="color: #00AA00;">,</span> from<span style="color: #00AA00;">&#40;</span><span style="color: #cc00cc;">#939393</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">,</span> to<span style="color: #00AA00;">&#40;</span><span style="color: #cc00cc;">#474747</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>I also added rounded corners to the bottom of each sub-menu. Again this isn&#8217;t support on all browsers. To do this I modified &#8220;#access ul ul,&#8221; adding the following CSS. The extra bottom padding gives room for the rounded corners.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#access</span> ul ul <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">padding-bottom</span><span style="color: #00AA00;">:</span><span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#474747</span><span style="color: #00AA00;">;</span>
	-moz-border-radius-bottomleft<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
	-webkit-border-bottom-left-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
	-moz-border-radius-bottomright<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
	-webkit-border-bottom-right-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>The key parts of the CSS that tell the menus to appear on mouseover are below:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#access</span> ul ul <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
	...
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>and</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#access</span> ul li<span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&gt;</span> ul <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>The first part tells the browser not to initially display the nested menus, but the second says do show them when the parent item is moused-over. To get our animation working, we&#8217;re going to comment out the &#8220;display:block&#8221; CSS &#8211; we&#8217;re going to instead control the display menu event with JavaScript.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#access</span> ul li<span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&gt;</span> ul <span style="color: #00AA00;">&#123;</span>
	<span style="color: #808080; font-style: italic;">/*display:block;*/</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>The simplest way to do this is with the help of a JavaScript library like <a href="http://www.jquery.com" target="_blank">jQuery</a>. WordPress already comes with jQuery so we need to load it in using the <a href="http://codex.wordpress.org/Function_Reference/wp_enqueue_script" target="_blank">wp_enqueue_script function</a>. The enqueue function is the safe way to add JavaScripts to WordPress to safeguard against various conflicts. We&#8217;re also going to load in a second JavaScript file we&#8217;re about to create called navigation.js.</p>
<p>Open up the header.php file and add</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> 
&nbsp;
wp_enqueue_script<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'jquery'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
wp_enqueue_script<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'unitzNav'</span><span style="color: #339933;">,</span> get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'template_directory'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/navigation.js&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>to the HEAD section of the document. We&#8217;re now loading up the jQuery library automatically for use with every page. Now it&#8217;s time to create the navigation.js file we referenced earlier &#8211; create this file in the same directory as the rest of the theme files.</p>
<p>If you&#8217;re unfamiliar with the power of jQuery there are ample tutorials and discussions online. In a nutshell, jQuery makes once complicated JavaScript tasks very simple, that work in just about every browser.  We&#8217;re going to be using a simple effect for our menu animation but, many jQuery menu plugins and navigation techniques are available that you can use as well. <a href="http://designm.ag/tutorials/jquery-navigation/" target="_blank">Here</a> and <a href="http://www.1stwebdesigner.com/resources/38-jquery-and-css-drop-down-multi-level-menu-solutions/" target="_links">here</a> are resources to explore many such techniques.</p>
<p>Put the following in your navigation.js file:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">jQuery<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #006600; font-style: italic;">//initial the menus</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;ul.menu li&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">mouseover</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">find</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;ul.sub-menu&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">animate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><span style="color: #3366CC;">&quot;height&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;show&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;opacity&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;show&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">800</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;swing&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">hover</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">find</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;ul.sub-menu&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">animate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><span style="color: #3366CC;">&quot;height&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;hide&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;opacity&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;hide&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;slow&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Believe it or not, this short section of code is all it takes to get the drop down menu animation working across most browsers with jQuery. The outer wrapper is a jQuery function call that runs when the page is finished loading. It then tells the browser to animate open the instance of ul class=&#8221;sub-menu&#8221; whenever a parent list item is moused over.  Then, using the hover function, it tells the browser to animate closed this same menu when either the parent item or menu is moused out. </p>
<p>On the <a href="http://www.jquery.com" target="_blank">jQuery</a> website you can read more about this syntax and the available function parameters &#8211; many types of animations and effects can be used here.</p>
<p>This simple approach does have limitations &#8211; specifically, although the Twenty Ten theme and WordPress&#8217;s menu manager support more than two levels of navigation, this jQuery implementation does not and will break the lower menus. However, considering the relatively simple modifications, the effect is quite effective. </p>
<p>Thanks for taking the time to read these posts &#8211; I hope it gets you excited for the power of WordPress 3.0&#8217;s menu management and gets your thinking about ways to style and animate your own menus.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="675" height="481" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=12117988&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed type="application/x-shockwave-flash" width="675" height="481" src="http://vimeo.com/moogaloop.swf?clip_id=12117988&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<iframe class="me-likey" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.unitz.com%2Fu-notez%2F2010%2F05%2Fhow-to-style-animate-wordpress-3-menus%2F&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;height=80&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:80px"></iframe>]]></content:encoded>
			<wfw:commentRss>http://www.unitz.com/u-notez/2010/05/how-to-style-animate-wordpress-3-menus/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Using the WordPress 3.0 Menus Feature Part 1</title>
		<link>http://www.unitz.com/u-notez/2010/05/how-to-use-the-wordpress-3-menus-feature/</link>
		<comments>http://www.unitz.com/u-notez/2010/05/how-to-use-the-wordpress-3-menus-feature/#comments</comments>
		<pubDate>Thu, 20 May 2010 02:36:43 +0000</pubDate>
		<dc:creator>Paul Reilly</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[User interfaces]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Menus]]></category>
		<category><![CDATA[Navigation]]></category>
		<category><![CDATA[WordPress 3.0]]></category>

		<guid isPermaLink="false">http://www.unitz.com/u-notez/?p=190</guid>
		<description><![CDATA[WordPress 3.0 adds a powerful new feature in Menus management. This post describes this feature and explains how to use it.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.unitz.com/u-notez/wp-content/uploads/2010/05/images.jpg"><img class="alignright size-full wp-image-194" title="images" src="http://www.unitz.com/u-notez/wp-content/uploads/2010/05/images.jpg" alt="" width="118" height="118" /></a>While WordPress 3.0 still hasn&#8217;t been officially released, the Beta releases have been available for testing for awhile now. A new feature that is getting a lot of <a href="http://net.tutsplus.com/tutorials/wordpress/10-features-to-look-forward-to-in-wordpress-3-0/" target="_blank">press</a> is the menus option. In this post, I&#8217;ll demonstrate how this new functionality works. I think you&#8217;ll agree that it has significant potential (see the video at the end of the post).  In my <a href="http://www.unitz.com/u-notez/2010/05/how-to-style-animate-wordpress-3-menus/">second post</a> in this series, I&#8217;ll delve into the code and show how to make modifications to the display of the menus, using CSS and <a href="http://www.jquery.com">jQuery</a>.</p>
<p>To follow along, you&#8217;ll need to download WordPress 3.o. You can visit the <a href="http://wordpress.org/development/" target="_blank">WordPress development blog </a>to find a link to the latest Beta, and soon version 3.0 will be released <a href="http://wordpress.org/download/" target="_blank">officially</a>. WordPress.org provides excellent installation <a href="http://codex.wordpress.org/Main_Page" target="_blank">documentation</a> if you need help installing.</p>
<p><span id="more-190"></span></p>
<h2>What is it?</h2>
<p>WordPress has come a long way since starting as purely a blogging platform. Thanks to its open framework, it has been modified through plug-ins to be a powerful content management system (CMS). Developers started using WordPress to drive entire sites full of content &#8211; not just blogs.  However, to do so required tricks and kludges to work properly. WordPress 3.0 makes the process much easier and truly makes WordPress a viable CMS platform.</p>
<div id="attachment_197" class="wp-caption alignleft" style="width: 385px"><a href="http://www.unitz.com/u-notez/wp-content/uploads/2010/05/menus-sample.gif"><img class="size-full wp-image-197" title="menus-sample" src="http://www.unitz.com/u-notez/wp-content/uploads/2010/05/menus-sample.gif" alt="" width="375" height="230" /></a><p class="wp-caption-text">Simple Menus Controlled Through WordPress</p></div>
<p>WordPress has allowed users to create two different types of content &#8211; posts and pages. Posts are the blog posts themselves, generated over time. Pages, which are created through a similar interface, were meant to hold static content. All WordPress installations start with a single About Us &#8220;page&#8221; that the blogger can use to describe themselves. Developers have utilized these &#8220;pages&#8221; to create entire sites and used WordPress as a CMS so end users could edit content themselves. These developers used to have to manually create the navigation structure though, digging deep into the code, in order to create links to all of the pages they created. With WordPress 3.0, regular users can now not only create pages but also organize and arrange them into menus through the Menus sections&#8217; simple drag and drop interface.</p>
<h2>How do you use it?</h2>
<p>This post assumes that you&#8217;re using the default WordPress 3.0 Theme, called Twenty Ten, which has support for the menu manager built in. My  <a href="http://www.unitz.com/u-notez/2010/05/how-to-style-animate-wordpress-3-menus/">next post</a> in this series will explain how to modify the theme and change the display of the menu.</p>
<p>To explore the Menus feature,  start by creating a few sample pages in your fresh WordPress 3.0 installation. In my visual examples I have created a few pages named after fruits and colors. If you need help learning how to use the WordPress interface to create pages, WordPress.org has excellent <a href="http://codex.wordpress.org/Main_Page" target="_blank">documentation</a>.</p>
<div id="attachment_195" class="wp-caption alignright" style="width: 285px"><a href="http://www.unitz.com/u-notez/wp-content/uploads/2010/05/menu-admin1.gif"><img class="size-full wp-image-195" title="menu-admin1" src="http://www.unitz.com/u-notez/wp-content/uploads/2010/05/menu-admin1.gif" alt="" width="275" height="418" /></a><p class="wp-caption-text">The Menus page in WordPress 3.0</p></div>
<p>Once your pages are created, click on the menus link in the left column of the administration area, under the &#8220;Appearance&#8221; heading. Please note that users need appropriate permissions to access this link. Two new columns of options appear to the right.</p>
<p>The left column allows you to choose the type of link you want to add to your menu. There are three types of menu items you can add:</p>
<ul>
<li><strong>Custom Links</strong> allow you to add menu items that link to external web pages. Enter the page&#8217;s address in the URL box and the name you want to use in the label box. In my visual examples I have used this section to add links to Google and Yahoo!</li>
<li><strong>Pages</strong> is where you add menu items that link to the WordPress pages you have created &#8211; in my examples the colors and fruits pages are available to me.</li>
<li><strong>Categories</strong> is the final option, and if you have created categories of blog posts, pages that list all posts in that category appear here.</li>
</ul>
<p>Select the check boxes next to the pages you want and click add to your menu. Add a few custom links if you&#8217;d like as well. These items will now all appear in the right column in a vertical list. The Twenty Ten theme draws the menus horizontally, so you need to visualize the appearance of the items left to right instead of top to bottom.</p>
<div id="attachment_196" class="wp-caption alignleft" style="width: 385px"><a href="http://www.unitz.com/u-notez/wp-content/uploads/2010/05/menu-admin2.gif"><img class="size-full wp-image-196" title="menu-admin2" src="http://www.unitz.com/u-notez/wp-content/uploads/2010/05/menu-admin2.gif" alt="" width="375" height="381" /></a><p class="wp-caption-text">Organizing Menu Items in WordPress 3.0</p></div>
<p>Now click and drag the items in the right column &#8211; you will notice that you can arrange them and adjust them left and right. The order you arrange them in is the order in which they appear. The adjustments you make left and right determine their hierarchy in the site. The leftmost items are your primary navigation. Items nested one notch to the right are the secondary navigation of their parent, and so on. In the Twenty Ten theme, the primary navigation items appear at all times at the top of the page, and when you mouse over them the secondary navigation menus appear. The third tier menus and so on appear to the right of their parent items when the parent is moused over.</p>
<p>WordPress generates standard XHTML <a href="http://www.alistapart.com/articles/taminglists/" target="_blank">lists for the menus</a>, which a WordPress template developer can then use to style your navigation menus any way you choose. Check back for part two of this series to see an example of how these menus can be modified visually.</p>
<h2>Who will use it?</h2>
<p>Although this functionality doesn&#8217;t seem particularly groundbreaking, it makes the process of adding pages and organizing content vastly simpler than before. Prior to WordPress 3.0 adding pages and updating navigation menus almost always required a phone call to the developer, which meant additional costs and lost turnaround time. Now website owners of nearly all technical skill levels can easily keep their sites updated and organized, without delay and without sacrificing the look and feel of the navigation.</p>
<p>View a demonstration of the functionality below &#8211; I first show the menu with 3 items &#8211; then I nest one menu under another through a simple drag and drop and reload the page to show the change.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="625" height="414" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=11886550&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed type="application/x-shockwave-flash" width="625" height="414" src="http://vimeo.com/moogaloop.swf?clip_id=11886550&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>In my  <a href="http://www.unitz.com/u-notez/2010/05/how-to-style-animate-wordpress-3-menus/">next post</a>, I will discuss the code that the Menus function generates, and show you how to add animation and style changes to it. Thanks for reading!</p>
<iframe class="me-likey" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.unitz.com%2Fu-notez%2F2010%2F05%2Fhow-to-use-the-wordpress-3-menus-feature%2F&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;height=80&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:80px"></iframe>]]></content:encoded>
			<wfw:commentRss>http://www.unitz.com/u-notez/2010/05/how-to-use-the-wordpress-3-menus-feature/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>5 Reasons to Re-Evaluate your Web Vendors</title>
		<link>http://www.unitz.com/u-notez/2010/05/5-reasons-to-reevaluate-your-web-vendors/</link>
		<comments>http://www.unitz.com/u-notez/2010/05/5-reasons-to-reevaluate-your-web-vendors/#comments</comments>
		<pubDate>Mon, 03 May 2010 16:23:00 +0000</pubDate>
		<dc:creator>Paul Reilly</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Marketing]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[User interfaces]]></category>
		<category><![CDATA[Vendors]]></category>

		<guid isPermaLink="false">http://www.unitz.com/u-notez/?p=164</guid>
		<description><![CDATA[&#8220;Wow how time flies! Remember way back in 2003, when the company decided we needed a fantastic website, with all of the latest bells and whistles? Well we did it, and it served us quite well at first. But it is showing its age now though, isn&#8217;t it? I guess it&#8217;s time to call the [...]]]></description>
			<content:encoded><![CDATA[<p>&#8220;Wow how time flies! Remember way back in 2003, when the company decided we needed a fantastic website, with all of the latest bells and whistles? Well we did it, and it served us quite well at first. But it is showing its age now though, isn&#8217;t it? I guess it&#8217;s time to call the designers and developers and make some changes&#8230;.&#8221;</p>
<p>Does this scenario sound familiar? It&#8217;s sometimes hard to believe, but given the rapid speed of Internet growth, the cutting edge technology that companies worked so hard to implement just a few years ago is now outdated and insufficient.  I&#8217;ve been working with many companies that are coming to this realization, and an unfortunate trend has appeared. These companies, sadly are completely determined to keep using their 3rd party vendors and service providers.</p>
<p><span id="more-164"></span>Services and vendor offerings I am referring to include web hosting,  email, e-commerce and payment systems, surveys, content management  systems and video and photo services.  Reasons that companies don&#8217;t want to change vendors vary &#8211; they don&#8217;t want to make the effort required to change, they feel entrenched, they&#8217;re nervous of possible ramifications, etc.  Although these can sometimes be valid reasons, more often than not this short-sightedness ends up being more expensive, provides customers a sub-par user experience and limits the company in serveral other ways. Read on to learn why.</p>
<ol>
<li><strong>Cost</strong><br />
Cost is the most straightforward reason to consider a vendor switch. In the last five years, the number of internet service vendors has exploded &#8211; which has driven down overall costs. More products are based on open standards and existing frameworks and more are sold as a service and hosted in the cloud. Contrast this to what it took to install something like a shopping cart several years ago &#8211; then it was proprietary and customized &#8211; at a high cost. Often clients are still paying monthly fees for these outdated services &#8211; and drastically overpaying at that. Now they can consider new options and opportunities that improve what they offer their customers, at a much lower cost over the life of the website.</li>
<li><strong>Ease of Implementation<br />
</strong>Companies remember the hassles and time required to add that shopping cart or add that video to their site years ago and are hesitant to go through the same ordeal again. The small vendors they selected from limited options years ago took forever to respond and had poor documentation.  However, much has changed &#8211; many current providers are bigger with much larger customer bases. They&#8217;ve greatly improved the implementation process, with excellent documentation and sample code and robust APIs that give more flexibility for implementations. There are many customers that share sample code and have documented their implementations. Forums and responsive users abound to discuss and help in using the products. <em>Current vendors offer more services that are easier to add and maintain than before, at a reasonable cost</em>.</li>
<li><strong>More Available Options<br />
</strong>Today&#8217;s established vendors have a more dedicated focus and larger teams working to support their products. They are working to make their products as useful as possible and offer many new features and options. These new features make your website more useful to your own customers.</li>
<li><strong>Better Customer Support<br />
</strong>Along with some of the reasons these products are easier to implement is the improved customer support &#8211; the vendors are larger or more specialized and have knowledgeable dedicated staff to help your company use their products. And through forums and development websites, more customers are active in the discussions as well &#8211; making it much easier to implement the products than in the past.<strong> </strong></li>
<li><strong>Growth Opportunities<br />
</strong>Finally, the way the product will grow and improve is important to consider. Many of the vendors that have been around for many years have all but given up on keeping their products current. Reasons vary &#8211; perhaps their customer base is small and the product isn&#8217;t worth upgrading. Perhaps the vendors don&#8217;t have the right staff to keep the product current. If your vendor&#8217;s offering is the same now as it was five years ago &#8211; chances are they aren&#8217;t looking for ways to improve their product and your business &#8211; switching to a dedicated vendor will better ensure that your website will grow with more and better functionality in the future.</li>
</ol>
<p>With these reasons in hand, consider your current vendors and if they&#8217;re really meeting your needs. If you&#8217;re not sure, start researching their competition. Check the services provided and pricing. You may be surprised at what&#8217;s possible out of the box now, and how reasonably it can be priced. Good resources, aside from just <a href="http://www.google.com" target="_blank">Googling, </a>include <a href="http://www.techcrunch.com" target="_blank">TechCrunch </a>and <a href="http://www.mashable.com" target="_blank">Mashable</a>.</p>
<p>Let me know your thoughts. Have you found a new vendor that drastically improved your website?</p>
<iframe class="me-likey" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.unitz.com%2Fu-notez%2F2010%2F05%2F5-reasons-to-reevaluate-your-web-vendors%2F&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;height=80&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:80px"></iframe>]]></content:encoded>
			<wfw:commentRss>http://www.unitz.com/u-notez/2010/05/5-reasons-to-reevaluate-your-web-vendors/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Automate Your Christmas Lights!</title>
		<link>http://www.unitz.com/u-notez/2009/12/automate-your-holiday-lights/</link>
		<comments>http://www.unitz.com/u-notez/2009/12/automate-your-holiday-lights/#comments</comments>
		<pubDate>Thu, 10 Dec 2009 20:35:00 +0000</pubDate>
		<dc:creator>Paul Reilly</dc:creator>
				<category><![CDATA[Fun]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[holiday]]></category>
		<category><![CDATA[lighting]]></category>

		<guid isPermaLink="false">http://www.unitz.com/u-notez/?p=144</guid>
		<description><![CDATA[As the holidays fast approach, millions of us are pulling decorations out of the attic, grabbing extension cords and untangling the lights. Last weekend I set up the tree, put lights outside, and put candle lights in each of my windows. It certainly looked nice and festive, but I quickly dreaded having to plug and [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_153" class="wp-caption alignright" style="width: 160px"><img class="size-thumbnail wp-image-153" src="http://www.unitz.com/u-notez/wp-content/uploads/2009/12/xmaslights-150x150.jpg" alt="Holiday Lights Display" width="150" height="150" /><p class="wp-caption-text">Holiday Lights Display</p></div>
<p>As the holidays fast approach, millions of us are pulling decorations out of the attic, grabbing extension cords and untangling the lights. Last weekend I set up the tree, put lights outside, and put candle lights in each of my windows. It certainly looked nice and festive, but I quickly dreaded having to plug and unplug each set of lights every day.</p>
<p>Fortunately, I had a solution! Using X10 automation modules, my windows computer and about 30 minutes of effort, my lights now turn on and off automatically every day!  This post details the steps I took to accomplish this, and provides some resources so you can set up a similar solution yourself.</p>
<p><span id="more-144"></span>The X10 automation system is technology that send signals across your home wiring, to turn on and off lights and devices you plug in to power outlets. To get up and running yourself, you&#8217;ll need a starter X10 kit &#8211; I recommend the <a title="X10 Firecracker Kit" href="http://www.x10.com/automation/firecracker.htm" target="_blank">Firecracker Kit</a>.</p>
<div id="attachment_149" class="wp-caption alignleft" style="width: 160px"><img class="size-thumbnail wp-image-149" src="http://www.unitz.com/u-notez/wp-content/uploads/2009/12/fc_remote-150x150.jpg" alt="X10 Firecracker Kit" width="150" height="150" /><p class="wp-caption-text">X10 Firecracker Kit</p></div>
<p>Be forewarned &#8211; the x10.com store is notorious for popup ads and gaudy design. Despite this, their products are quite reputable. Also please note that most of the items mentioned in this post are available on <a title="X10 Firecracker Kit Search on eBay" href="http://shop.ebay.com/i.html?_nkw=x10+firecracker+kit&amp;_sacat=0&amp;_trksid=p3286.m270.l1313&amp;_odkw=x10&amp;_osacat=0" target="_blank">eBay</a> for a fraction of the cost. The Firecracker kit has four items &#8211; a transceiver which receives the on/off signals and sends them through the house wiring (and can turn on/off an item plugged into it), a lamp module which can turn lights plugged into it on and off when it receives a signal sent by the transceiver, and a computer interface and remote control &#8211; both of which send the on/off signals to the transceiver. You can purchase any additional lamp outlets you may need on eBay inexpensively as well.</p>
<p>The x10 transceiver lets you select a letter from A-P via a simple dial.  This is the &#8216;house code&#8217; for that transceiver. Each of your lamp modules then let you pick both a house code and unit number from 2 to 16 (the transceiver itself is unit 1). Each combination of house and unit numbers must be unique. So to get started, set your transceiver to house code A, plug a set of Christmas lights into it, and plug it into the wall. Then take your lamp module, set it to house code A and unit number 2, and also plug lights into it and plug it into the wall. You&#8217;re ready to turn these on and off using the included remote control! Set your remote to house code A, and then hit the unit 1 and unit 2 on buttons &#8211; voila! the lights turn on. With more lamp modules you can set all the lights you want to control throughout your house this way, as long as the unit numbers are all unique.</p>
<p>After setting this up, you could just stop here. You can now turn off all of the lights with the push of a few buttons &#8211; much simpler than walking all over the house twice every day! But I wanted the lights to turn on and off completely automatically. To accomplish this, I utilized the fourth item that came with the Firecracker kit &#8211; the computer interface, called the CM17A. This tiny little item plugs into your computer&#8217;s serial port and sends the same signals that the remote control sends, only you can configure your computer to send the signals automatically. The following explanation is done on a computer running Windows 7, but the same steps can be accomplished on other versions of Windows, though the steps may look a bit different.</p>
<div id="attachment_154" class="wp-caption alignright" style="width: 552px"><img class="size-full wp-image-154" title="X10 Command Line" src="http://www.unitz.com/u-notez/wp-content/uploads/2009/12/commandprompt1.GIF" alt="commandprompt" width="542" height="214" /><p class="wp-caption-text">X10 Command Line Example</p></div>
<p><a title="x10 christmas light automation" href="http://www.x10.com/friends/refer.cgi?pmreil@yahoo.com" target="_blank">X10.com</a> offers software packages for a fee that allow you to set up complicated macros &#8211; this was overkill for me as I just needed to send on and off signals once a day. I used a very simple command line tool created by Adam Davis instead. Once you have the CM17A plugged into your computer, visit his <a href="http://www.ubasics.com/adam/electronics/cm17.shtml" target="_blank">website </a>and download the CM17A.zip file. Create a c:\cm17a\ directory and unzip the files there. Then start up the &#8216;Command Prompt&#8217; under the accessories section of the start menu.</p>
<p>Type &#8216;CD C:\cm17a\&#8217; into the command prompt, as illustrated in the screen shot. The cm17a program is in this directory and is called with two or more parameters. The first is the COM port number of your actual cm17a device on your computer. The second parameter is the device you want to control. If you want to turn the lights plugged into the lamp module you set as house code A, unit 2, the parameter is &#8216;a2on,&#8217; and to turn it off, it is &#8216;a2off.&#8217; You can string multiple commands in a row, separated by spaces, so if your cm17a device was on COM port 2, and you want to turn lamp modules a2, a3 and a4 on, you would type &#8216;cm17a 2 a2on a3on a4on&#8217; into the command prompt and press enter. All three sets of lights should now turn on. By the way, if you don&#8217;t know the COM port of your device, it is likely 1,2,3 or 4, so you can type a few sample commands varying the code to see which one works.</p>
<div id="attachment_147" class="wp-caption alignright" style="width: 391px"><img class="size-full wp-image-147" title="X10 Batch Script" src="http://www.unitz.com/u-notez/wp-content/uploads/2009/12/batch.GIF" alt="X10 Batch Script" width="381" height="141" /><p class="wp-caption-text">X10 Batch Script Example</p></div>
<p>Okay cool, so now we have a way to control the lights via our computer, now what? The next step is to load up notepad &#8211; we have to create a very simple batch script. This simply means we type the command that you&#8217;d use through the command prompt into a file that we can run automatically later. Follow the screen shots to see how to type the command and how to save the file &#8211; its important to select save as file type &#8216;any file&#8217; and save the file with .bat at the end. Otherwise it will append .txt to the end and this won&#8217;t work.</p>
<div id="attachment_151" class="wp-caption alignnone" style="width: 626px"><img class="size-full wp-image-151 " title="Save As Batch Script" src="http://www.unitz.com/u-notez/wp-content/uploads/2009/12/saveas.GIF" alt="Save as a .bat file in Notepad" width="616" height="332" /><p class="wp-caption-text">Save as a .bat file in Notepad</p></div>
<p>After you created a lightson.bat, now do the same process again, changing the on&#8217;s in the file to off, and save it as lightsoff.bat.</p>
<p>The final step is to tell windows to run these batch scripts automatically. This is done using the windows &#8216;Task Scheduler, which is in Start -&gt; Accessories -&gt; System Tools. When the task scheduler is up and running, select Action -&gt; Create Basic Task. We&#8217;re going to create two of these, one to turn the lights on, and one to turn the lights off. Name and describe the task any way you&#8217;d like. Under Trigger, select daily, and then pick the time you want the lights to turn on. Under action, select Start a Program, and then browse to C:\cm17a\ and selected the lightson.bat script that you created. Also, under the &#8216;Start In&#8217; box, type in &#8216;c:\cm17a\.&#8217;  Once you&#8217;ve finished the lights on task, do the same thing to create a lights off task, which runs at a different time and calls the lightsoff.bat program instead. Optionally you can refine the tasks further by editing their properties, telling the computer to turn itself on if it&#8217;s in sleep mode to run the task, along with other options.</p>
<p><img class="size-full wp-image-157 alignnone" title="X10 Task Manager" src="http://www.unitz.com/u-notez/wp-content/uploads/2009/12/task1.GIF" alt="X10 Task Manager Example" width="463" height="347" /></p>
<p><img class="alignnone size-full wp-image-146" title="X10 Task Action" src="http://www.unitz.com/u-notez/wp-content/uploads/2009/12/actions.GIF" alt="X10 Task Action" width="709" height="278" /></p>
<p>This was the last step! Now your Holiday lights will turn themselves on and off each day without you having to lift another finger. Happy holidays from <a href="http://www.unitz.com">Unitz</a>!</p>
<hr />
<h2>Additional Notes and Tips:</h2>
<p>The bigger your house or your lighting needs, the more complex this setup can become. The following are a few additional tips that might help.</p>
<ul>
<li>Your whole house isn&#8217;t necessarily on the same wiring circuit. This means that some light modules might not respond to transceiver signals. There are a few solutions here. X10 offers hardware to bridge your circuits, but this requires opened up your power panel. A simpler solution is to just buy an additional transceiver and set it to another house code &#8211; then set the light modules on this circuit to the new house code.</li>
<li>To avoid buying lots of lamp modules, you can use extension cords and power strips to turn on multiple lights with one receiver &#8211; make you&#8217;re only using low wattage lights though.</li>
<li>Newer computers don&#8217;t always have serial ports. Fortunately for just a few dollars on eBay you can buy Serial to USB converters, which solve this problem.</li>
<li>The wireless range of CM17A might not be wide enough to reach your transceiver(s). You can purchase serial extension cables (or in a USBextension if using a USB to serial adapter.)</li>
<li>Obviously this solution can be used for many more uses aside from Christmas lights.</li>
<li>If you want to do more complex actions, or involve other <a title="x10 christmas light automation" href="http://www.x10.com/friends/refer.cgi?pmreil@yahoo.com" target="_blank">X10 products</a> like video cameras, they do offer software that has more control.</li>
<li>X10 lamp modules do not currently work well with compact fluorescent bulbs.</li>
<li>This same approach can be used with other operating systems. In Linux it can be done with bash scripts and cron jobs &#8211; the following explains how to control the <a href="http://pr0gr4mm3r.com/linux/getting-your-x10-cm17a-firecracker-module-working-in-linux/" target="_blank">CM17a in Linux</a>.</li>
<li>If you only want to control some devices automatically, you can still use the remote control to power other devices.</li>
<li><a href="http://www.iopus.com/guides/winscheduler.htm" target="_blank">http://www.iopus.com/guides/winscheduler.htm</a> has additional examples of how to schedule tasks in windows.</li>
</ul>
<iframe class="me-likey" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.unitz.com%2Fu-notez%2F2009%2F12%2Fautomate-your-holiday-lights%2F&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;height=80&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:80px"></iframe>]]></content:encoded>
			<wfw:commentRss>http://www.unitz.com/u-notez/2009/12/automate-your-holiday-lights/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Subversion (SVN) Repository Integration with Mantis Bug Tracker</title>
		<link>http://www.unitz.com/u-notez/2009/10/subversion-svn-integration-mantisbt/</link>
		<comments>http://www.unitz.com/u-notez/2009/10/subversion-svn-integration-mantisbt/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 23:23:39 +0000</pubDate>
		<dc:creator>Chris Dornfeld</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.unitz.com/u-notez/?p=118</guid>
		<description><![CDATA[I recently set out to integrate a Subversion (SVN) source control repository with MantisBT, a free bug tracking system.  I quickly found John Reese&#8217;s Source Integration plugin &#8212; available for the MantisBT 1.2.0 development branch &#8212; which promised to do exactly what I needed.
Reese provides step-by-step instructions to configure his plugin for a Git [...]]]></description>
			<content:encoded><![CDATA[<p>I recently set out to integrate a <a href="http://subversion.tigris.org/" target="_blank">Subversion</a> (SVN) source control repository with <a href="http://www.mantisbt.org/" target="_blank">MantisBT</a>, a free bug tracking system.  I quickly found John Reese&#8217;s <a href="http://git.mantisforge.org/w/source-integration.git" target="_blank">Source Integration plugin</a> &#8212; available for the MantisBT 1.2.0 development branch &#8212; which promised to do exactly what I needed.</p>
<p>Reese provides <a href="http://leetcode.net/blog/2009/01/integrating-git-svn-with-mantisbt/" target="_blank">step-by-step instructions</a> to configure his plugin for a Git version control repository, but although his plugin supports Subversion, no walkthrough was available for an SVN scenario.  Configuring the SVN plugin correctly took some trial and error, so I decided to document the process for others who want to get Mantis and SVN to play nicely.</p>
<p><span id="more-118"></span><br />
<h3>Prerequisites</h3>
<ul>
<li><a href="http://www.mantisbt.org/download.php" target="_blank">MantisBT 1.2.0</a>
<ul>
<li>As of this post, the latest development version is 1.2.0rc2</li>
</ul>
</li>
<li><a href="http://git.mantisforge.org/w/source-integration.git" target="_blank">Mantis Source Integration plugin</a>
<ul>
<li>This post refers to development snapshot version Fri, 2 Oct 2009 10:50:07</li>
</ul>
</li>
<li><a href="http://subversion.tigris.org/" target="_blank">Subversion</a> command-line binaries
<ul>
<li>The binaries must be available on the web server where MantisBT is installed</li>
</ul>
</li>
<li>A Subversion repository
<ul>
<li>It&#8217;s not necessary for the repository itself to reside on the web server where MantisBT is installed</li>
</ul>
</li>
<li><a href="http://www.websvn.info/" target="_blank">WebSVN</a>, a web front-end for Subversion respositories
<ul>
<li>It&#8217;s not necessary for WebSVN to reside on the web server where MantisBT is installed or the server where your Subversion repository resides</li>
<li>WebSVN should be configured to access the Subversion repository you&#8217;ll integrate with Mantis</li>
</ul>
</li>
</ul>
<p>Technically, WebSVN is optional: the Source Integration plugin will pull in your Subversion history using the command-line binaries alone.  However, without WebSVN, links to browse the repository and view files or diffs from within MantisBT won&#8217;t work.</p>
<h3>Source Integration Plugin Setup</h3>
<p>Follow <a href="http://leetcode.net/blog/2009/01/integrating-git-svn-with-mantisbt/" target="_blank">John Reese&#8217;s instructions</a> through Step 4.  You should now have the plugin installed in your MantisBT environment:</p>
<p><img class="alignnone size-full wp-image-120" title="MantisBT Installed Plugins" src="http://www.unitz.com/u-notez/wp-content/uploads/2009/10/mantisbt-installed-plugins.png" alt="MantisBT Installed Plugins" width="690" height="417" /></p>
<p>Next, click on the <strong>Subversion / WebSVN Integration</strong> link to access the configuration for the SVN plugin:</p>
<p style="text-align: center;"><img class="size-full wp-image-121 aligncenter" title="MantisBT SVN Configuration" src="http://www.unitz.com/u-notez/wp-content/uploads/2009/10/mantisbt-svn-configuration.png" alt="MantisBT SVN Configuration" width="518" height="92" /></p>
<p>Fill in the location where the SVN command-line binaries reside on the web server.  In the example above, my SVN binary is <strong>/usr/local/bin/svn</strong>.  Be sure to only enter the directory portion of the path.  Beware: if you enter the path incorrectly, the form will not return an error message.</p>
<p>Proceed with Steps 5 through 7 in Reese&#8217;s instructions, selecting <strong>WebSVN</strong> as the repository type.  When you reach Step 8, the repository settings screen will look like this:</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-122" title="MantisBT WebSVN Repository" src="http://www.unitz.com/u-notez/wp-content/uploads/2009/10/mantisbt-websvn-repository.png" alt="MantisBT WebSVN Repository" width="610" height="514" /></p>
<p>The settings are a little ambiguous at first: we&#8217;re creating a WebSVN repository, so does the <strong>URL</strong> field refer to the WebSVN address or the URL to the SVN repository itself?  The <strong>WebSVN URL</strong> field calls for a trailing slash, but what about the <strong>WebSVN Path</strong>?</p>
<p>Beta software being what it is, the instructions will surely improve as the software evolves.  For now, here are some additional guidelines to clarify the usage of each field shown above.</p>
<ul>
<li><strong>Name</strong>
<ul>
<li>A title of your choosing that will be used to describe this repository in the Mantis repositories list.</li>
</ul>
</li>
<li><strong>URL</strong>
<ul>
<li>The full Subversion (not WebSVN) repository URL</li>
<li>In the example above, the repository resides at <strong>svn://svnserver/myproject/subdir</strong></li>
</ul>
</li>
<li><strong>SVN Username</strong>
<ul>
<li>A valid username for accessing the SVN repository you entered in the <strong>URL</strong> field</li>
</ul>
</li>
<li><strong>SVN <strong>P</strong></strong><strong>assword</strong>
<ul>
<li>The corresponding password for the username you entered</li>
</ul>
</li>
<li><strong>WebSVN URL</strong>
<ul>
<li>The base URL of your WebSVN installation: that is, the WebSVN landing page where you select from a list of repositories to browse</li>
<li>In the example above, the WebSVN landing page is located at <strong>http://svnserver/websvn/</strong></li>
</ul>
</li>
<li><strong>WebSVN Name</strong>
<ul>
<li>The name you entered in your WebSVN settings to describe the SVN repository</li>
<li>In the example above, the WebSVN repository name is <strong>myproject</strong></li>
<li>Keep in mind that WebSVN names are not necessarily related to the SVN repository URL.  Check your WebSVN config file (or compare with the repository list on the WebSVN landing page) to make sure you are using the appropriate spelling and capitalization here.</li>
</ul>
</li>
<li><strong>WebSVN Path</strong>
<ul>
<li>This is the path to the Subversion repository, relative to the top-level folder in your WebSVN repository</li>
<li>In the example above, we have a WebSVN repository named <strong>myproject</strong> which is configured in our WebSVN settings to point to the Subversion URL <strong>svn://svnserver/myproject</strong></li>
<li>Since we want this MantisBT repository to point to <strong>svn://svnserver/myproject/subdir</strong> (one level deeper), the WebSVN path, relative to the WebSVN top-level path, is <strong>/subdir/</strong></li>
<li>In my testing, it was necessary to <strong>include both leading and trailing slashes</strong> in the WebSVN Path field</li>
</ul>
</li>
<li><strong>Standard Repository</strong>
<ul>
<li>Check this box if you use the conventional Subversion folder structure. In other words, the Subversion repository URL you entered should have subfolders named <strong>trunk</strong>, <strong>branches</strong> and <strong>tags</strong>, respectively.</li>
</ul>
</li>
<li><strong>Trunk Path/Branch Path/Tag Path</strong>
<ul>
<li>If you didn&#8217;t check the Standard Repository box, and if you use a different folder layout for your trunk/branches/tags folders, enter the paths here.</li>
<li>I assume that these paths are relative to the Subversion URL.  However, I haven&#8217;t tested these settings and some trial and error may be needed.</li>
</ul>
</li>
<li><strong>Ignore Other Paths</strong>
<ul>
<li>If you didn&#8217;t check the Standard Repository box, and if you  entered your custom trunk/branches/tags folder paths in the previous fields, you can tell Mantis to ignore any other paths under the Subversion repository URL by checking this box.</li>
</ul>
</li>
</ul>
<p>When you&#8217;re finished, click the <strong>Update Repository</strong> button and proceed with the remaining instructions.</p>
<p>Thanks to John Reese and the other plugin contributors for a useful add-on.</p>
<iframe class="me-likey" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.unitz.com%2Fu-notez%2F2009%2F10%2Fsubversion-svn-integration-mantisbt%2F&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;height=80&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:80px"></iframe>]]></content:encoded>
			<wfw:commentRss>http://www.unitz.com/u-notez/2009/10/subversion-svn-integration-mantisbt/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
		<item>
		<title>Easy Color Customization for Embedded Google Calendars</title>
		<link>http://www.unitz.com/u-notez/2009/04/color-customization-for-embedded-google-calendars/</link>
		<comments>http://www.unitz.com/u-notez/2009/04/color-customization-for-embedded-google-calendars/#comments</comments>
		<pubDate>Tue, 21 Apr 2009 18:07:22 +0000</pubDate>
		<dc:creator>Chris Dornfeld</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[User interfaces]]></category>

		<guid isPermaLink="false">http://www.unitz.com/u-notez/?p=12</guid>
		<description><![CDATA[Clients often come to us for assistance integrating an events calendar into a web site, and we frequently recommend Google Calendar.  It has a flexible and user-friendly interface for both web site visitors and calendar managers.  What it doesn&#8217;t have, unfortunately, is a way to customize its color scheme.
I had the opportunity to tackle this [...]]]></description>
			<content:encoded><![CDATA[<p>Clients often come to us for assistance integrating an events calendar into a web site, and we frequently recommend <a href="http://calendar.google.com/" target="_blank">Google Calendar</a>.  It has a flexible and user-friendly interface for both web site visitors and calendar managers.  What it doesn&#8217;t have, unfortunately, is a way to customize its color scheme.</p>
<p>I had the opportunity to tackle this shortcoming for a recent project and you can find a copy of my script below, followed by an explanation of the approach I used.<span id="more-12"></span>  With this script, you&#8217;ll be able to set your own color scheme for an embedded Google Calendar.  To illustrate, here are some screenshots showing &#8220;before&#8221; (on the left) and &#8220;after&#8221; (on the right):</p>
<p><img class="alignnone size-full wp-image-24" title="gcalendar-wrapper screenshots" src="http://www.unitz.com/u-notez/wp-content/uploads/2009/04/gcalendar-wrapper-screenshots.gif" alt="gcalendar-wrapper screenshots" width="690" height="236" /></p>
<p>Of course, you can use this script to make your embedded calendar appear any color you like.</p>
<h3>Requirements</h3>
<ul>
<li>PHP 4.3.0 or later</li>
<li>Support for one of the following JSON libraries:
<ul>
<li><a href="http://pecl.php.net/package/json" target="_blank">PECL JSON extension</a> (built in to PHP 5.2.0 and higher) <em>or</em></li>
<li><a href="http://pear.php.net/package/Services_JSON" target="_blank">PEAR::Services_JSON</a> package</li>
</ul>
</li>
<li>Support for one of the following http methods:
<ul>
<li><a href="http://www.php.net/manual/en/curl.installation.php" target="_blank">cURL extension</a> <em>or</em></li>
<li><a href="http://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen" target="_blank">allow_url_fopen</a> configuration option</li>
</ul>
</li>
</ul>
<p>Check your <a href="http://www.php.net/phpinfo#function.phpinfo.examples" target="_blank">phpinfo</a> screen to see if your server meets the requirements &mdash; or, if you&#8217;re feeling lucky, just cross your fingers and run the script.</p>
<h3>Installation and Usage</h3>
<p><strong>1.</strong> Create your Google Calendar and <a href="http://www.google.com/support/calendar/bin/answer.py?hl=en&amp;answer=41207" target="_blank">embed the calendar on your web site</a> using your preferred size and settings.  Make sure it appears correctly with the default Google Calendar &#8220;skin&#8221;.</p>
<p><strong>2.</strong> <strong><a href="/downloads/gcalendar-wrapper-20100516.zip" onclick="pageTracker._trackPageview('/downloads/gcalendar-wrapper.zip')">Download the wrapper script</a></strong> (version 2010-05-16) as a ZIP file</p>
<p><strong>3.</strong> Unzip the archive to extract the script itself, <strong>gcalendar-wrapper.php</strong></p>
<p><strong>4.</strong> Edit <strong>gcalendar-wrapper.php</strong> in a text editor, such as Notepad</p>
<p><strong>5.</strong> Customize the following lines at the top of the script according to your needs:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>23
24
25
26
27
28
29
30
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
 * Set your color scheme below
 */</span>
<span style="color: #000088;">$calColorBgDark</span>      <span style="color: #339933;">=</span> <span style="color: #0000ff;">'#c3d9ff'</span><span style="color: #339933;">;</span>	<span style="color: #666666; font-style: italic;">// dark background color</span>
<span style="color: #000088;">$calColorTextOnDark</span>  <span style="color: #339933;">=</span> <span style="color: #0000ff;">'#000000'</span><span style="color: #339933;">;</span>	<span style="color: #666666; font-style: italic;">// text appearing on top of dark bg color</span>
<span style="color: #000088;">$calColorBgLight</span>     <span style="color: #339933;">=</span> <span style="color: #0000ff;">'#e8eef7'</span><span style="color: #339933;">;</span>	<span style="color: #666666; font-style: italic;">// light background color</span>
<span style="color: #000088;">$calColorTextOnLight</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'#000000'</span><span style="color: #339933;">;</span>	<span style="color: #666666; font-style: italic;">// text appearing on top of light bg color</span>
<span style="color: #000088;">$calColorBgToday</span>     <span style="color: #339933;">=</span> <span style="color: #0000ff;">'#ffffcc'</span><span style="color: #339933;">;</span>	<span style="color: #666666; font-style: italic;">// background color for &quot;today&quot; box</span></pre></td></tr></table></div>

<p>You can use a tool like the one at <a href="http://html-color-codes.info/" target="_blank">html-color-codes.info</a> to pick your HTML color codes.</p>
<p><strong>6.</strong> Upload <strong>gcalendar-wrapper.php</strong> to your web server</p>
<p><strong>7.</strong> On the pages where you display an embedded Google Calendar, change the calendar embedding code to point to <strong>gcalendar-wrapper.php</strong> instead of <strong>http://www.google.com/calendar/embed</strong> (or the equivalent URL if you&#8217;re using Google Apps for Domains).  For example, if your embedding code currently looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">iframe</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.google.com/calendar/embed?src=usa__en%40holiday.calendar.google.com</span>
<span style="color: #009900;">&amp;amp;ctz=America%2FNew_York&quot;</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot; border-width:0 &quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;800&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;600&quot;</span></span>
<span style="color: #009900;"><span style="color: #000066;">frameborder</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000066;">scrolling</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;no&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">iframe</span>&gt;</span></pre></div></div>

<p>edit the HTML to look like this instead:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">iframe</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;gcalendar-wrapper.php?src=usa__en%40holiday.calendar.google.com</span>
<span style="color: #009900;">&amp;amp;ctz=America%2FNew_York&quot;</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot; border-width:0 &quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;800&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;600&quot;</span></span>
<span style="color: #009900;"><span style="color: #000066;">frameborder</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000066;">scrolling</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;no&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">iframe</span>&gt;</span></pre></div></div>

<p><strong>8.</strong> Browse to your page to test out your customized calendar!  If you still see the standard Google Calendar appearance, make sure to clear your browser&#8217;s cache and try again.</p>
<h3>Limitations</h3>
<p>To keep things simple, this script reduces the Google Calendar color scheme to just 5 different colors, even though Google&#8217;s original stylesheet uses more shades.  In addition, images within the interface (such as the month previous/next arrows and Print icon) can&#8217;t be customized and will still appear in their original color (blue).</p>
<p>After creating this solution, I came across a similar skinning effort called <del datetime="2010-05-17T02:43:55+00:00">MyGoogleCal4</del> <a href="http://www.restylegc.com/" target="_blank" rel="nofollow">RESTYLEgc</a> that allows more fine-grained control over the calendar appearance.  It takes more legwork to create your own theme, but anyone interested in replacing the calendar graphics or making advanced stylesheet changes should definitely give it a look.</p>
<h3>Technical Details</h3>
<p>The <strong>gcalendar-wrapper.php</strong> script works by downloading the embedded Google Calendar source code from Google&#8217;s server, modifying CSS styles and JavaScript on the fly, then outputting the customized calendar code to the user&#8217;s browser.  The Google Calendar embedding code contains a JSON-encoded data structure with information about the calendar events plus external links to a JavaScript library and CSS stylesheet located elsewhere on Google&#8217;s servers.  For simplicity, this script just inserts new CSS and JavaScript directly into the main embedding code to override the relevant parts of those external files.</p>
<p>To change the color scheme, I started by scraping the stock Google Calendar stylesheet and identifying the minimal set of styles needed to apply new colors.  New style rules are generated dynamically based on the color scheme settings to save the hassle of repeatedly copying and pasting color codes in several places.  These custom styles are then inserted at the end of the HEAD section of the embedding code with priority set to override the original styles.</p>
<p>Google Calendar&#8217;s code makes use of relative links and file references that get thrown off when routed through the wrapper script, so it&#8217;s also necessary to make a change to the base URL within the JSON data structure that holds calendar event data.  The JSON string first has to be spliced out using a regular expression and converted to a PHP data structure we can manipulate, then serialized back into a JSON string to replace the original data.</p>
<h3>Keep in Mind&#8230;</h3>
<p>The calendar customization script is closely tied to Google Calendar&#8217;s underlying stylesheets and JavaScript code.  When Google launches a new version of Google Calendar (as they&#8217;ve done in the past when launching new features) this script may need to be updated to reflect Google&#8217;s changes.  When that happens, your embedded calendars may revert to the standard Google Calendar appearance or may even show an error message.  Don&#8217;t forget to check up on your calendars periodically so you&#8217;ll know if Google has made any major changes.  I&#8217;ll make an effort to post an updated wrapper script whenever I see that Google has revised its code.</p>
<p>Feel free to respond in the comments below with questions or suggestions.  I hope you find the script useful!</p>
<iframe class="me-likey" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.unitz.com%2Fu-notez%2F2009%2F04%2Fcolor-customization-for-embedded-google-calendars%2F&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;height=80&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:80px"></iframe>]]></content:encoded>
			<wfw:commentRss>http://www.unitz.com/u-notez/2009/04/color-customization-for-embedded-google-calendars/feed/</wfw:commentRss>
		<slash:comments>73</slash:comments>
		</item>
	</channel>
</rss>
