<?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>The Book and the Cover &#187; Tips</title>
	<atom:link href="http://benjaminsterling.com/category/tips/feed/" rel="self" type="application/rss+xml" />
	<link>http://benjaminsterling.com</link>
	<description>Ok, you did not judge the book by it&#039;s cover, great.  Now, read the whole thing before passing judgment.</description>
	<lastBuildDate>Tue, 24 Mar 2009 19:25:03 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Chrome For Standalone Web Apps</title>
		<link>http://benjaminsterling.com/chrome-for-standalone-web-apps/</link>
		<comments>http://benjaminsterling.com/chrome-for-standalone-web-apps/#comments</comments>
		<pubDate>Fri, 12 Dec 2008 16:00:27 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Chrome]]></category>
		<category><![CDATA[Firefox]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/?p=124</guid>
		<description><![CDATA[Thanks to Seano I have been using Google Chrome to make my life easier.  How you ask?  Well, Chrome has a really nice bookmarking feature that will allow you to create a standalone instance of Chrome for what ever bookmarked site you want.  I use it religiously for Pandora , Google reader, Whos.amung.us, hulu, and [...]]]></description>
			<content:encoded><![CDATA[<p>Thanks to Seano I have been using Google Chrome to make my life easier.  How you ask?  Well, Chrome has a really nice bookmarking feature that will allow you to create a standalone instance of Chrome for what ever bookmarked site you want.  I use it religiously for <a href="http://www.pandora.com/people/benjamin.sterling">Pandora </a>, Google reader, <a href="http://whos.amung.us/stats/1cbz6ztl/">Whos.amung.us</a>, hulu, and gmail.</p>
<p>The process is pretty simple, make sure you have <a href="http://www.google.com/chrome">Chrome</a> installed, open and browse to the website you would like to bookmark.</p>
<p><img class="alignright size-full wp-image-135" title="chromeoptions" src="http://benjaminsterling.com/wp-content/uploads/2008/12/chromeoptions.jpg" alt="" width="238" height="263" /><br />
Just left of the address bar is a button, click that and you will get a drop down list of options. Click on &#8220;Create application shortcuts&#8230;&#8221; and you get the below dialog box. In my case, I am creating a &#8220;Quick launch bar shortcut for Last.fm, the other options are &#8220;Start menu&#8221; and &#8220;Desktop.&#8221;</p>
<p><img class="aligncenter size-full wp-image-136" title="chromeshortcuts" src="http://benjaminsterling.com/wp-content/uploads/2008/12/chromeshortcuts.jpg" alt="" width="367" height="336" /></p>
<p>After you hit ok you while now see you newly create shortcut:</p>
<p><img src="http://benjaminsterling.com/wp-content/uploads/2008/12/quick.png" alt="" title="quick" width="74" height="69" class="aligncenter size-full wp-image-137" /></p>
<p><strong>Update:</strong> Rey points out that this feature has been available for Firefox in the form of a plugin for some time via the Prism add-on found here: <a href='https://addons.mozilla.org/en-US/firefox/addon/6665' rel='nofollow'>https://addons.mozilla.org/en-US/firefox/addon/6665</a></p>
]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/chrome-for-standalone-web-apps/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Separating Pings/Trackbacks from Comments in WordPress 2.7</title>
		<link>http://benjaminsterling.com/separating-pingstrackbacks-from-comments-in-wordpress-27/</link>
		<comments>http://benjaminsterling.com/separating-pingstrackbacks-from-comments-in-wordpress-27/#comments</comments>
		<pubDate>Wed, 10 Dec 2008 17:00:35 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Comments]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/?p=125</guid>
		<description><![CDATA[With the coming release of WordPress 2.7 we now have an easy way to separate out your pings and trackbacks from your comments.
I will be using the default theme WordPress comes with to show you have to do this.  Below is the important code you should focus on:

PLAIN TEXT
PHP:




&#60;?php if &#40; have_comments&#40;&#41; &#41; : ?&#62;


&#160; [...]]]></description>
			<content:encoded><![CDATA[<p>With the coming release of WordPress 2.7 we now have an easy way to separate out your pings and trackbacks from your comments.</p>
<p>I will be using the default theme WordPress comes with to show you have to do this.  Below is the important code you should focus on:<br />
<span id="more-125"></span></p>
<div class="igBar"><span id="lphp-7"><a href="#" onclick="javascript:showPlainTxt('php-7'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-7">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span> have_comments<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#41;</span> : <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;h3 id=<span style="color:#FF0000;">"comments"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">&lt;?php</span> comments_number<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'No Responses'</span>, <span style="color:#FF0000;">'One Response'</span>, <span style="color:#FF0000;">'% Responses'</span> <span style="color:#006600; font-weight:bold;">&#41;</span>;?&gt; to &amp;<span style="color:#008000; font-style:italic;">#8220;&lt;?php the_title(); ?&gt;&amp;#8221;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/h3&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;ol <span style="color:#000000; font-weight:bold;">class</span>=<span style="color:#FF0000;">"commentlist"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">&lt;?php</span> wp_list_comments<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/ol&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;div <span style="color:#000000; font-weight:bold;">class</span>=<span style="color:#FF0000;">"navigation"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;div <span style="color:#000000; font-weight:bold;">class</span>=<span style="color:#FF0000;">"alignleft"</span>&gt;&lt;?php previous_comments_link<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> ?&gt;&lt;/div&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;div <span style="color:#000000; font-weight:bold;">class</span>=<span style="color:#FF0000;">"alignright"</span>&gt;&lt;?php next_comments_link<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> ?&gt;&lt;/div&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/div&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#616100;">else</span> : <span style="color:#FF9933; font-style:italic;">// this is displayed if there are no comments so far ?&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'open'</span> == <span style="color:#0000FF;">$post</span>-&gt;<span style="color:#006600;">comment_status</span><span style="color:#006600; font-weight:bold;">&#41;</span> : <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;!-- <span style="color:#616100;">If</span> comments are open, but there are no comments. --&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#616100;">else</span> : <span style="color:#FF9933; font-style:italic;">// comments are closed ?&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;!-- <span style="color:#616100;">If</span> comments are closed. --&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;p <span style="color:#000000; font-weight:bold;">class</span>=<span style="color:#FF0000;">"nocomments"</span>&gt;Comments are closed.&lt;/p&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#616100;">endif</span>; <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#616100;">endif</span>; <span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>With WordPress 2.7, you would edit the <em>wp_list_comments();</em> function to look like <em>wp_list_comments('type=comment');</em> and just after line 8 (&#8249;/ol&#8250;) put:</p>
<div class="igBar"><span id="lphp-8"><a href="#" onclick="javascript:showPlainTxt('php-8'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-8">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;h3 id=<span style="color:#FF0000;">"pings"</span>&gt;Trackbacks/Pingbacks&lt;/h3&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;ol <span style="color:#000000; font-weight:bold;">class</span>=<span style="color:#FF0000;">"pinglist"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<span style="color:#000000; font-weight:bold;">&lt;?php</span> wp_list_comments<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'type=pings'</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/ol&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>That bit of code will echo out all the pings, so your final code should look like:</p>
<div class="igBar"><span id="lphp-9"><a href="#" onclick="javascript:showPlainTxt('php-9'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-9">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span> have_comments<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#41;</span> : <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;h3 id=<span style="color:#FF0000;">"comments"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">&lt;?php</span> comments_number<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'No Responses'</span>, <span style="color:#FF0000;">'One Response'</span>, <span style="color:#FF0000;">'% Responses'</span> <span style="color:#006600; font-weight:bold;">&#41;</span>;?&gt; to &amp;<span style="color:#008000; font-style:italic;">#8220;&lt;?php the_title(); ?&gt;&amp;#8221;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/h3&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;ol <span style="color:#000000; font-weight:bold;">class</span>=<span style="color:#FF0000;">"commentlist"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">&lt;?php</span> wp_list_comments<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'type=comment'</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/ol&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;h3 id=<span style="color:#FF0000;">"pings"</span>&gt;Trackbacks/Pingbacks&lt;/h3&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;ol <span style="color:#000000; font-weight:bold;">class</span>=<span style="color:#FF0000;">"pinglist"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">&lt;?php</span> wp_list_comments<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'type=pings'</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/ol&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;div <span style="color:#000000; font-weight:bold;">class</span>=<span style="color:#FF0000;">"navigation"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;div <span style="color:#000000; font-weight:bold;">class</span>=<span style="color:#FF0000;">"alignleft"</span>&gt;&lt;?php previous_comments_link<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> ?&gt;&lt;/div&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;div <span style="color:#000000; font-weight:bold;">class</span>=<span style="color:#FF0000;">"alignright"</span>&gt;&lt;?php next_comments_link<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> ?&gt;&lt;/div&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/div&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#616100;">else</span> : <span style="color:#FF9933; font-style:italic;">// this is displayed if there are no comments so far ?&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'open'</span> == <span style="color:#0000FF;">$post</span>-&gt;<span style="color:#006600;">comment_status</span><span style="color:#006600; font-weight:bold;">&#41;</span> : <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;!-- <span style="color:#616100;">If</span> comments are open, but there are no comments. --&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#616100;">else</span> : <span style="color:#FF9933; font-style:italic;">// comments are closed ?&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;!-- <span style="color:#616100;">If</span> comments are closed. --&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;p <span style="color:#000000; font-weight:bold;">class</span>=<span style="color:#FF0000;">"nocomments"</span>&gt;Comments are closed.&lt;/p&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#616100;">endif</span>; <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#616100;">endif</span>; <span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Ah, but there is a problem, what if you don't have any comments but you have pings/trackback or visa-versa?  You should now be able to wrap each H3+OL combiniation in code like:</p>
<div class="igBar"><span id="lphp-10"><a href="#" onclick="javascript:showPlainTxt('php-10'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-10">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span> ! <a href="http://www.php.net/empty"><span style="color:#000066;">empty</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$comments_by_type</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'comment'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#41;</span> : <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;h3 id=<span style="color:#FF0000;">"comments"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">&lt;?php</span> comments_number<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'No Responses'</span>, <span style="color:#FF0000;">'One Response'</span>, <span style="color:#FF0000;">'% Responses'</span> <span style="color:#006600; font-weight:bold;">&#41;</span>;?&gt; to &amp;<span style="color:#008000; font-style:italic;">#8220;&lt;?php the_title(); ?&gt;&amp;#8221;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/h3&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;ol <span style="color:#000000; font-weight:bold;">class</span>=<span style="color:#FF0000;">"commentlist"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">&lt;?php</span> wp_list_comments<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'type=comment'</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/ol&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#616100;">endif</span>; <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span> ! <a href="http://www.php.net/empty"><span style="color:#000066;">empty</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$comments_by_type</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'pings'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#41;</span> : <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;h3 id=<span style="color:#FF0000;">"pings"</span>&gt;Pingbacks/Trackbacks&lt;/h3&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;ol <span style="color:#000000; font-weight:bold;">class</span>=<span style="color:#FF0000;">"pinglist"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">&lt;?php</span> wp_list_comments<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'type=pings'</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/ol&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#616100;">endif</span>; <span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>And that's it, your Pingback and Comments are now separate.  Have a look at the final code below and let me know if I missed anything or if you have any questions.</p>
<div class="igBar"><span id="lphp-11"><a href="#" onclick="javascript:showPlainTxt('php-11'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-11">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span> have_comments<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#41;</span> : <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span> ! <a href="http://www.php.net/empty"><span style="color:#000066;">empty</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$comments_by_type</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'comment'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#41;</span> : <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;h3 id=<span style="color:#FF0000;">"comments"</span>&gt;&lt;?php comments_number<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'No Responses'</span>, <span style="color:#FF0000;">'One Response'</span>, <span style="color:#FF0000;">'% Responses'</span> <span style="color:#006600; font-weight:bold;">&#41;</span>;?&gt; to &amp;<span style="color:#008000; font-style:italic;">#8220;&lt;?php the_title(); ?&gt;&amp;#8221;&lt;/h3&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;ol <span style="color:#000000; font-weight:bold;">class</span>=<span style="color:#FF0000;">"commentlist"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">&lt;?php</span> wp_list_comments<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'type=comment'</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;/ol&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#616100;">endif</span>; <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span> ! <a href="http://www.php.net/empty"><span style="color:#000066;">empty</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$comments_by_type</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'pings'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#41;</span> : <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;h3 id=<span style="color:#FF0000;">"pings"</span>&gt;Pingbacks/Trackbacks&lt;/h3&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;ol <span style="color:#000000; font-weight:bold;">class</span>=<span style="color:#FF0000;">"pinglist"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">&lt;?php</span> wp_list_comments<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'type=pings'</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;/ol&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#616100;">endif</span>; <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;div <span style="color:#000000; font-weight:bold;">class</span>=<span style="color:#FF0000;">"navigation"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;div <span style="color:#000000; font-weight:bold;">class</span>=<span style="color:#FF0000;">"alignleft"</span>&gt;&lt;?php previous_comments_link<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> ?&gt;&lt;/div&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;div <span style="color:#000000; font-weight:bold;">class</span>=<span style="color:#FF0000;">"alignright"</span>&gt;&lt;?php next_comments_link<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> ?&gt;&lt;/div&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/div&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#616100;">else</span> : <span style="color:#FF9933; font-style:italic;">// this is displayed if there are no comments so far ?&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'open'</span> == <span style="color:#0000FF;">$post</span>-&gt;<span style="color:#006600;">comment_status</span><span style="color:#006600; font-weight:bold;">&#41;</span> : <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;!-- <span style="color:#616100;">If</span> comments are open, but there are no comments. --&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#616100;">else</span> : <span style="color:#FF9933; font-style:italic;">// comments are closed ?&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;!-- <span style="color:#616100;">If</span> comments are closed. --&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;p <span style="color:#000000; font-weight:bold;">class</span>=<span style="color:#FF0000;">"nocomments"</span>&gt;Comments are closed.&lt;/p&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#616100;">endif</span>; <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#616100;">endif</span>; <span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>Update:</strong> In regards to Chris' question, there is a way to separate out your comments count; after some research you can use the <em>get_comments_number</em> filter, you just need to create function and put it in your <em>functions.php</em> file.</p>
<div class="igBar"><span id="lphp-12"><a href="#" onclick="javascript:showPlainTxt('php-12'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-12">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">add_filter<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'get_comments_number'</span>, <span style="color:#FF0000;">'get_new_comment_count'</span>, <span style="color:#CC66CC;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">function</span> get_new_comment_count<span style="color:#006600; font-weight:bold;">&#40;</span> <span style="color:#0000FF;">$count</span> <span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/global"><span style="color:#000066;">global</span></a> <span style="color:#0000FF;">$wp_query</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#616100;">return</span> <a href="http://www.php.net/count"><span style="color:#000066;">count</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$wp_query</span>-&gt;<span style="color:#006600;">comments_by_type</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'comment'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>If you don't already have a functions.php file in your theme, just add one.</p>
]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/separating-pingstrackbacks-from-comments-in-wordpress-27/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Tip for weekending 12/06/08</title>
		<link>http://benjaminsterling.com/tip-for-weekending-120608/</link>
		<comments>http://benjaminsterling.com/tip-for-weekending-120608/#comments</comments>
		<pubDate>Sat, 06 Dec 2008 14:00:28 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[browsing]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/?p=121</guid>
		<description><![CDATA[Backwards-Compatible Spam and Delete Buttons for WordPress
Add Spam and Delete buttons right to the comments for WordPress installs below 2.6.
Disabling the update nag
Removes that nagging "WordPress [Version] is available! Please update now" message from your admin area.
Add Your Website to Firefox’s Search Bar Using OpenSearch XML
The ability to search right from your browser’s address toolbar [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://perishablepress.com/press/2008/12/01/spam-delete-buttons-links-for-old-versions-wordpress/">Backwards-Compatible Spam and Delete Buttons for WordPress</a><br />
Add Spam and Delete buttons right to the comments for WordPress installs below 2.6.</p>
<p><a href="http://yoast.com/disable-update-nag/">Disabling the update nag</a><br />
Removes that nagging "WordPress [Version] is available! Please update now" message from your admin area.</p>
<p><a href="http://davidwalsh.name/open-search">Add Your Website to Firefox’s Search Bar Using OpenSearch XML</a></p>
<blockquote><p>The ability to search right from your browser’s address toolbar is a Godsend. No more extra Google or Yahoo page loads — simply open a new tab and roll off your search terms. Of course Firefox comes with Google, Yahoo, and other search engines by default, but what if you want to offer search for YOUR website in the address bar? Using Open Search, you can create an XML file to do just that.</p></blockquote>
<p><a href="http://ottodestruct.com/blog/2008/09/29/wordpress-27-comments-enhancements/">WordPress 2.7 Comments Enhancements</a></p>
<blockquote><p>WordPress 2.7 includes a lot of new enhancements, but one of the big ones is the new comment functionality. Comments can be threaded, paged, etc. This is all built in, but unfortunately, your theme must support it. So, for theme authors, I’d suggest getting to work on making your themes compatible right away.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/tip-for-weekending-120608/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress: Theme Test Drive</title>
		<link>http://benjaminsterling.com/wordpress-theme-test-drive/</link>
		<comments>http://benjaminsterling.com/wordpress-theme-test-drive/#comments</comments>
		<pubDate>Fri, 05 Dec 2008 14:00:36 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[Theme]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/?p=123</guid>
		<description><![CDATA[
Have you ever needed to see what a theme looks like with your content but you did not want to have to recreate your whole site on a testing server and import all your data?  Well, Theme Test Drive to the rescue.
You simply download the plugin, unzip it, upload it to your WordPress install, install [...]]]></description>
			<content:encoded><![CDATA[<p><a href='http://benjaminsterling.com/wp-content/uploads/2008/12/theme_test_drive.png'><img src="http://benjaminsterling.com/wp-content/uploads/2008/12/theme_test_drive-300x264.png" alt="" title="theme_test_drive" width="300" height="264" class="alignright size-medium wp-image-126 featureImg" /></a></p>
<p>Have you ever needed to see what a theme looks like with your content but you did not want to have to recreate your whole site on a testing server and import all your data?  Well, <a href="http://www.prelovac.com/vladimir/wordpress-plugins/theme-test-drive" target="_blank">Theme Test Drive</a> to the rescue.</p>
<p>You simply download the plugin, unzip it, upload it to your WordPress install, install the plugin and then select the theme you want to test.  This will allow you to go through your site as if it were live and see how it looks and works.</p>
<p>Now, have you ever need to make some changes to your current theme but did not want to shut down your site and you did not want your visitors to see a busted site?  Well, Theme Test Drive to the rescue again.</p>
<p>Follow the steps above, but instead of installing a new theme, just duplicate your current theme via your ftp of choice.  Once you have the duplicate theme, go into the dup and make a change to the style.css file and change the "Theme Name" - I just renamed the theme to have a 2 at the end of the name.</p>
<p>Reupload that style.css file and in the select menu under the Design -&gt; Theme Test Drive page select your newly named theme and click enable at the bottom.</p>
<p>After that, just work off of the duplicate theme till you have everything looking the way you want and just either copy over all the changes to the old theme folder or change your default theme to the duplicate.</p>
<p>Complete install instructions, support and download can be found on the <a href="http://www.prelovac.com/vladimir/wordpress-plugins/theme-test-drive" target="_blank">plugins site</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/wordpress-theme-test-drive/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Really Simple History: Ajax history and bookmarking library</title>
		<link>http://benjaminsterling.com/really-simple-history-ajax-history-and-bookmarking-library/</link>
		<comments>http://benjaminsterling.com/really-simple-history-ajax-history-and-bookmarking-library/#comments</comments>
		<pubDate>Wed, 03 Dec 2008 16:00:51 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/?p=119</guid>
		<description><![CDATA[For some time now I have been using Really Simple History for my applications that use a good amount of AJAX.  RSH is exactly what it sounds like, it is a really simple way of adding history and bookmarking to your AJAXified apps.  To see it in action have a look at the Mason's [...]]]></description>
			<content:encoded><![CDATA[<p>For some time now I have been using <a href="http://code.google.com/p/reallysimplehistory/" target="_blank">Really Simple History </a>for my applications that use a good amount of <abbr title="asynchronous JavaScript and XML">AJAX</abbr>.  <abbr title="Really Simple History">RSH</abbr> is exactly what it sounds like, it is a really simple way of adding history and bookmarking to your AJAXified apps.  To see it in action have a look at the <a href="http://admissions.gmu.edu/grad/matrix/" target="_blank">Mason's Graduate Requirements</a> site where it is being used to handle bookmarking for four separate parameters.</p>
<p>What I want to cover in the article is what I have learned and what steps I took when coding with RSH for the Mason project and for some other on going projects.</p>
<p>First thing you should do is download the <a href="http://reallysimplehistory.googlecode.com/files/RSH0.6FINAL.zip" target="_blank">Really Simple History code</a>.</p>
<p>Secondly, I have been using a modified version of <a href="http://adamv.com/dev/javascript/querystring" target="_blank">Adam Vandenberg's Querystring</a> functions which has only one modification to it.</p>
<div class="igBar"><span id="ljavascript-17"><a href="#" onclick="javascript:showPlainTxt('javascript-17'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-17">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>qs == <span style="color: #003366; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> qs = location.<span style="color: #006600;">search</span>.<span style="color: #006600;">substring</span><span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;color:#800000;">1</span>, location.<span style="color: #006600;">search</span>.<span style="color: #006600;">length</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">// changed to</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>qs == <span style="color: #003366; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> qs = location.<span style="color: #006600;">hash</span>.<span style="color: #006600;">replace</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066FF;">/^.*#/</span>, <span style="color: #3366CC;">''</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>You will need to set up your script is a particular way so that the history script is created first, and then initialized, at least the way I do it, when DOM is ready.  You can get away with doing it on Window.onload but since most likely your code will be minipulating the DOM, initializing on DOM ready is probably better for you.</p>
<p>I set up my inital code like below:</p>
<div class="igBar"><span id="ljavascript-18"><a href="#" onclick="javascript:showPlainTxt('javascript-18'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-18">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> initail = <span style="color: #003366; font-weight: bold;">false</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> qs = <span style="color: #003366; font-weight: bold;">null</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">window.<span style="color: #006600;">dhtmlHistory</span>.<span style="color: #006600;">create</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span>document<span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">.<span style="color: #006600;">ready</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; dhtmlHistory.<span style="color: #006600;">initialize</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; dhtmlHistory.<span style="color: #006600;">addListener</span><span style="color: #66cc66;">&#40;</span>theListener<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span>!initail<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; theListener<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Lines 1 and 2 we set up some globals we will be reusing later on and line 4 we create the history object.  Lines 5 and 6 should be familiar to you, here we just check to see if the DOM is ready, if so, we run the code in the containing function.  Line 8 we initialize the history script and at line 9 we set the listener to "theListener" which is a function I will point out further down the page.  You will see that I also have an IF statement that is checking to see if this is the initial run.  This is because the the RSH script does not run the listener script when it is initialized.</p>
<p>The next function is just a helper function I use all the time when dealing with the hash:</p>
<div class="igBar"><span id="ljavascript-19"><a href="#" onclick="javascript:showPlainTxt('javascript-19'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-19">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">hash = <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> location.<span style="color: #006600;">hash</span>.<span style="color: #006600;">replace</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066FF;">/^.*#/</span>, <span style="color: #3366CC;">''</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The last function is the "theListener" function which I referenced at line 9 of the second group of codes.  This function will get called each and every time the hash changes.</p>
<div class="igBar"><span id="ljavascript-20"><a href="#" onclick="javascript:showPlainTxt('javascript-20'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-20">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">theListener = <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span>!initail<span style="color: #66cc66;">&#41;</span> initail = <span style="color: #003366; font-weight: bold;">true</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; qs = <span style="color: #003366; font-weight: bold;">new</span> Querystring<span style="color: #66cc66;">&#40;</span> hash<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span> <span style="color: #000066; font-weight: bold;">typeof</span> qs.<span style="color: #006600;">get</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'cat'</span><span style="color: #66cc66;">&#41;</span> == <span style="color: #3366CC;">'undefined'</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// run cat specific code</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Although the RSH script does pass back two params you will see that I don't use them and the only real reason for this is that I felt it was too complicated and I never really figured out how I should use them.</p>
<p>At line 2 of the function we check to see if the function was already initiated.  Then at line 3 we set up a new Querystring reference - should probably change the name to hashstring or something like that at some point.  And from this point on, you can check your query string for what ever parameters you need to and run the appropriate codes.</p>
]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/really-simple-history-ajax-history-and-bookmarking-library/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Send Email Notifications for Broken Images Using jQuery Ajax</title>
		<link>http://benjaminsterling.com/send-email-notifications-for-broken-images-using-jquery-ajax/</link>
		<comments>http://benjaminsterling.com/send-email-notifications-for-broken-images-using-jquery-ajax/#comments</comments>
		<pubDate>Mon, 01 Dec 2008 16:00:51 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[Error]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/?p=120</guid>
		<description><![CDATA[David Walsh posted a priceless and overly useful post about Send Email Notifications for Broken Images Using MooTools Ajax but the only problem with that is that he used MooTools ;).
For those that want to do the same thing with jQuery here is the JavaScript code, please have a read at his post for the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://davidwalsh.name">David Walsh</a> posted a priceless and overly useful post about <a href="http://davidwalsh.name/email-image-error-mootools">Send Email Notifications for Broken Images Using MooTools Ajax</a> but the only problem with that is that he used MooTools ;).</p>
<p>For those that want to do the same thing with jQuery here is the JavaScript code, please have a read at <a href="http://davidwalsh.name/email-image-error-mootools">his post for the PHP code and any discussion his post sparks.</a></p>
<div class="igBar"><span id="ljavascript-22"><a href="#" onclick="javascript:showPlainTxt('javascript-22'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-22">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span>document<span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">.<span style="color: #006600;">ready</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'img'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">error</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; $.<span style="color: #006600;">post</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'ajax-image-error.php'</span>,<span style="color: #66cc66;">&#123;</span><span style="color: #3366CC;">'image'</span>:<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">src</span>,<span style="color: #3366CC;">'page'</span>:location.<span style="color: #006600;">href</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Yeah, I know, there is so much less code then the MooTools example, why is that?  Psstt... because jQuery is better ;).</p>
<p><a href="http://www.benjaminsterling.com/wp-content/files/brokenImages.htm" target="_blank" class="example {h:400,w:600}" data="">Here is a live demo (an email is not sent, but the returned data is appended to the page.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/send-email-notifications-for-broken-images-using-jquery-ajax/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>Notices, what notices?</title>
		<link>http://benjaminsterling.com/notices-what-notices/</link>
		<comments>http://benjaminsterling.com/notices-what-notices/#comments</comments>
		<pubDate>Mon, 24 Nov 2008 18:00:56 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[css]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/?p=112</guid>
		<description><![CDATA[I've been using Blueprint css framework for a bit now mainly for the typography structure it provides.  But lately I've been investigating the rest of the framework.  Just a few weeks ago I noticed some of the default classes it has for forms error, notice and success.
Although they do and look like you would expect [...]]]></description>
			<content:encoded><![CDATA[<p>I've been using Blueprint css framework for a bit now mainly for the typography structure it provides.  But lately I've been investigating the rest of the framework.  Just a few weeks ago I noticed some of the default classes it has for forms <em>error</em>, <em>notice </em>and <em>success</em>.</p>
<p>Although they do and look like you would expect I decided to add a little flare to them.</p>
<h3>The Look</h3>
<p><img class="aligncenter size-full wp-image-115" title="error_notice" src="http://benjaminsterling.com/wp-content/uploads/2008/11/error_notice.png" alt="" width="553" height="59" /></p>
<p><img class="aligncenter size-full wp-image-115" title="notice_notice" src="http://benjaminsterling.com/wp-content/uploads/2008/11/notice_notice.png" alt="" width="553" height="70" /></p>
<p><img class="aligncenter size-full wp-image-115" title="success_notice" src="http://benjaminsterling.com/wp-content/uploads/2008/11/success_notice.png" alt="" width="553" height="70" /></p>
<h3>The Code</h3>
<div class="igBar"><span id="lcss-24"><a href="#" onclick="javascript:showPlainTxt('css-24'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CSS:</span>
<div id="css-24">
<div class="css">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">.error, .notice, <span style="color: #6666ff;">.success </span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">padding</span>:.8em;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">margin-bottom</span>:1em;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; border<span style="color: #3333ff;">:2px </span>solid #ddd;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">padding-left</span>:5em;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; -moz-border-radius: <span style="color: #cc66cc;color:#800000;">0</span> 10px <span style="color: #cc66cc;color:#800000;">0</span> 10px;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; -webkit-border-radius: <span style="color: #cc66cc;color:#800000;">0</span> 10px <span style="color: #cc66cc;color:#800000;">0</span> 10px;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #6666ff;">.error </span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">background</span>:#FBE3E4 <span style="color: #993333;">url</span><span style="color: #66cc66;">&#40;</span>../img/cancel_48.png<span style="color: #66cc66;">&#41;</span> <span style="color: #993333;">no-repeat</span> 15px <span style="color: #993333;">center</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">color</span>:#8a1f11;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">border-color</span>:#FBC2C4;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #6666ff;">.notice </span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">background</span>:#FFF6BF <span style="color: #993333;">url</span><span style="color: #66cc66;">&#40;</span>../img/warning_48.png<span style="color: #66cc66;">&#41;</span> <span style="color: #993333;">no-repeat</span> 15px <span style="color: #993333;">center</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">color</span>:#514721;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">border-color</span>:#FFD324;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #6666ff;">.success </span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">background</span>:#E6EFC2 <span style="color: #993333;">url</span><span style="color: #66cc66;">&#40;</span>../img/accepted_48.png<span style="color: #66cc66;">&#41;</span> <span style="color: #993333;">no-repeat</span> 15px <span style="color: #993333;">center</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">color</span>:#264409;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">border-color</span>:#C6D880;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h3>The Closing</h3>
<p>Someone once told me, when optimizing my images for the web from Photoshop or Fireworks, don't use the default values.  I think the same should be said about using any of these css frameworks that are out there.  Get into the code and 1) learn what's going on and 2) experiment with the default values.  You will be glad you did.</p>
<p><strong>Credits</strong></p>
<ul>
<li>Icons from <a href="http://wefunction.com/2008/07/function-free-icon-set/">WeFunction</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/notices-what-notices/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Plugin Icon in WordPress 2.7</title>
		<link>http://benjaminsterling.com/new-plugin-icon-in-wordpress-27/</link>
		<comments>http://benjaminsterling.com/new-plugin-icon-in-wordpress-27/#comments</comments>
		<pubDate>Sun, 23 Nov 2008 16:00:09 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/?p=110</guid>
		<description><![CDATA[If you are a WordPress plugin Developer then you most likely have used the "add_menu_page" function before.  With WordPress 2.7 you can now add an icon to your plugin to be shown in the new side menu in the admin area.
PLAIN TEXT
PHP:




add_menu_page&#40; $page_title, $menu_title, $access_level, $file, $function = '', $icon_url = '' &#41; 






So in [...]]]></description>
			<content:encoded><![CDATA[<p>If you are a WordPress plugin Developer then you most likely have used the "add_menu_page" function before.  With WordPress 2.7 you can now add an icon to your plugin to be shown in the new side menu in the admin area.</p>
<div class="igBar"><span id="lphp-27"><a href="#" onclick="javascript:showPlainTxt('php-27'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-27">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">add_menu_page<span style="color:#006600; font-weight:bold;">&#40;</span> <span style="color:#0000FF;">$page_title</span>, <span style="color:#0000FF;">$menu_title</span>, <span style="color:#0000FF;">$access_level</span>, <span style="color:#0000FF;">$file</span>, <span style="color:#0000FF;">$function</span> = <span style="color:#FF0000;">''</span>, <span style="color:#0000FF;">$icon_url</span> = <span style="color:#FF0000;">''</span> <span style="color:#006600; font-weight:bold;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>So in PhotoXhibit's case, I did the following:</p>
<div class="igBar"><span id="lphp-28"><a href="#" onclick="javascript:showPlainTxt('php-28'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-28">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">add_menu_page<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'PhotoXhibit'</span>,<span style="color:#FF0000;">'PhotoXhibit'</span>, <span style="color:#CC66CC;color:#800000;">7</span>, <span style="color:#0000FF;">$bp</span>, <a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span>&amp;amp;<span style="color:#0000FF;">$this</span>, <span style="color:#FF0000;">'showLandingPage'</span><span style="color:#006600; font-weight:bold;">&#41;</span>, <span style="color:#0000FF;">$this</span>-&amp;gt;imgBaseUrl.<span style="color:#FF0000;">'lphoto.png'</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>And I get:</p>
<p style="text-align: center;"><img class="alignnone size-full wp-image-111 aligncenter" title="photoxhibit_icon" src="http://benjaminsterling.com/wp-content/uploads/2008/11/photoxhibit_icon.png" alt="" width="155" height="50" /></p>
]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/new-plugin-icon-in-wordpress-27/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>New Favorite Actions in WordPress 2.7</title>
		<link>http://benjaminsterling.com/new-favorite-actions-in-wordpress-27/</link>
		<comments>http://benjaminsterling.com/new-favorite-actions-in-wordpress-27/#comments</comments>
		<pubDate>Sat, 22 Nov 2008 16:43:22 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Plugin]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/?p=105</guid>
		<description><![CDATA[
WordPress 2.7 will be release sometime soon and with it comes a new feature call "favorite actions," it's a drop down menu that is sort of a quick launch to your most used actions.  Right now it only contains "Add New Post", "Add New Page" and "Manage Comments".  Like with most features in [...]]]></description>
			<content:encoded><![CDATA[<div class="featureImg"><img class="alignnone size-full wp-image-107" title="" src="http://benjaminsterling.com/wp-content/uploads/2008/11/favorite2.png" alt="New favorite actions dropdown (favorite_actions)" /></div>
<p>WordPress 2.7 will be release sometime soon and with it comes a new feature call "favorite actions," it's a drop down menu that is sort of a quick launch to your most used actions.  Right now it only contains "Add New Post", "Add New Page" and "Manage Comments".  Like with most features in WordPress, you can easily add to via the "add_filter" function link so:</p>
<div class="igBar"><span id="lphp-33"><a href="#" onclick="javascript:showPlainTxt('php-33'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-33">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">add_filter<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'favorite_actions'</span>, <span style="color:#FF0000;">'new_favorite_actions'</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The new function that builds out that drop down menu is called "favorite_actions" and is located in the "/wp-admin/includes/template.php" file.  The default menu structure array is below:</p>
<div class="igBar"><span id="lphp-34"><a href="#" onclick="javascript:showPlainTxt('php-34'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-34">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$actions</span> = <a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'post-new.php'</span> =&gt; <a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span>__<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'Add New Post'</span><span style="color:#006600; font-weight:bold;">&#41;</span>, <span style="color:#FF0000;">'edit_posts'</span><span style="color:#006600; font-weight:bold;">&#41;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'page-new.php'</span> =&gt; <a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span>__<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'Add New Page'</span><span style="color:#006600; font-weight:bold;">&#41;</span>, <span style="color:#FF0000;">'edit_pages'</span><span style="color:#006600; font-weight:bold;">&#41;</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'edit-comments.php'</span> =&gt; <a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span>__<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'Manage Comments'</span><span style="color:#006600; font-weight:bold;">&#41;</span>, <span style="color:#FF0000;">'moderate_comments'</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The first part of the array "post-new.php" is of course the page it will be going to, the second page is an array with the text that would be shown in the menu and the permission.  Have a look-see at<a href="http://codex.wordpress.org/Roles_and_Capabilities" target="_blank"> roles and capabilities on the WordPress</a> site for more information about permission.</p>
<p>Although I don't see a way to add favorite actions on the fly there is a way to add some via a plugin.  In my PhotoXhibit plugin I will be using the following code to add menu options for adding a new gallery and for managing galleries.</p>
<div class="igBar"><span id="lphp-35"><a href="#" onclick="javascript:showPlainTxt('php-35'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-35">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$newactions</span> = <a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'admin.php?page=px_build'</span> =&gt; <a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span>__<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'Add New Gallery'</span><span style="color:#006600; font-weight:bold;">&#41;</span>, <span style="color:#FF0000;">'level_10'</span><span style="color:#006600; font-weight:bold;">&#41;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'admin.php?page=px_manage'</span> =&gt; <a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span>__<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'Manage Galleries'</span><span style="color:#006600; font-weight:bold;">&#41;</span>, <span style="color:#FF0000;">'level_10'</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">return</span> <a href="http://www.php.net/array_merge"><span style="color:#000066;">array_merge</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$actions</span>, <span style="color:#0000FF;">$newactions</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Notice how I am adding to the $action array, I am using the array_merge which does exactly what it says, it merges the two arrays.</p>
<h3>A Plugin</h3>
<p>Below is a basic plugin template that you can use to add your own menu items to the favorite menu.</p>
<div class="igBar"><span id="lphp-36"><a href="#" onclick="javascript:showPlainTxt('php-36'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-36">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">/*</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">Plugin Name: A Favorite Menu Action Plugin Template</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">Plugin URI: <a href='http://benjaminsterling.com' rel='nofollow'>http://benjaminsterling.com</a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">Description: This is a templete for you to build your own plugin</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">Author: Benjamin Sterling</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">Author URI: <a href='http://benjaminsterling.com/' rel='nofollow'>http://benjaminsterling.com/</a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">*/</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">add_filter<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'favorite_actions'</span>, <span style="color:#FF0000;">'bs_template_for_favorite'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">function</span> bs_template_for_favorite<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$actions</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$newactions</span> = <a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'admin.php?page=pluginshortcut/plugin.php'</span> =&gt; <a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span>__<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'Some plugin'</span><span style="color:#006600; font-weight:bold;">&#41;</span>, <span style="color:#FF0000;">'manage_options'</span><span style="color:#006600; font-weight:bold;">&#41;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'upload.php'</span> =&gt; <a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span>__<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'Manage Library'</span><span style="color:#006600; font-weight:bold;">&#41;</span>, <span style="color:#FF0000;">'edit_files'</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#616100;">return</span> <a href="http://www.php.net/array_merge"><span style="color:#000066;">array_merge</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$actions</span>, <span style="color:#0000FF;">$newactions</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h3>Final thoughts</h3>
<p>Although the new "favoriate_actions" function is nice and the favorite menu does what it needs to do, I am a bit nervous that plugin developers will not give their users the option to add to it and just force it upon them.  Which may not be an issue but what if you twenty plugins that all force their items in to the favorite list?  Or what if a plugin developer clears out the initial action array and puts in only their plugin URI?  It can get to be a bit hairy.</p>
<p>I would also say that this new feature can become quite powerful and useful.  What if someone comes up with a plugin, or WordPress institutes a feature, that tracks the pages you use most often and adds those pages to the list.  Or what about a plugin that attaches itself to the option area and has a checkbox for every admin page/action and you can click to add all the favs you want?  Any takers?</p>
]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/new-favorite-actions-in-wordpress-27/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Slide in tab window using jQuery</title>
		<link>http://benjaminsterling.com/slide-in-tab-window-using-jquery/</link>
		<comments>http://benjaminsterling.com/slide-in-tab-window-using-jquery/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 04:03:16 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/?p=104</guid>
		<description><![CDATA[Say you want to wanted to put little tabs - you know, the ones like what you get from a lawyer or a realestate again to point out important things - off the side of your page so that your users can click, bring that tab into view to see what important information you want [...]]]></description>
			<content:encoded><![CDATA[<p>Say you want to wanted to put little tabs - you know, the ones like what you get from a lawyer or a realestate again to point out important things - off the side of your page so that your users can click, bring that tab into view to see what important information you want to point out.  Yeah, I know, you've seen these "tabs" a millions times and that is fine, but you have not seen it from my site and most likely you were not secretly brainwashed into learning about other jQuery methods that you don't already use or know about.</p>
<p>So, let the <span style="text-decoration: line-through;">brainwashing</span> education begin!</p>
<h3>The Tabs</h3>
<p><del datetime="2008-11-20T16:39:56+00:00">Take a look off to the left</del> I moved the <a href="http://www.benjaminsterling.com/wp-content/files/sidetab.htm" target="_blank">demo here</a>, do you see the three tabs that are there, they are so spectacularly named "tab 1", "tab2" and, yup you guessed it, "tab3."  The html structure is pretty straight forward:</p>
<div class="igBar"><span id="ljavascript-40"><a href="#" onclick="javascript:showPlainTxt('javascript-40'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-40">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;div id=<span style="color: #3366CC;">"sideTabs"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;div <span style="color: #003366; font-weight: bold;">class</span>=<span style="color: #3366CC;">"tab"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;h3&gt;Tab <span style="color: #CC0000;color:#800000;">1</span>&lt;/h3&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;div <span style="color: #003366; font-weight: bold;">class</span>=<span style="color: #3366CC;">"gut"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;p&gt;Some text&lt;/p&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;/div&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/div&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;div <span style="color: #003366; font-weight: bold;">class</span>=<span style="color: #3366CC;">"tab"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;h3&gt;Tab <span style="color: #CC0000;color:#800000;">2</span>&lt;/h3&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;div <span style="color: #003366; font-weight: bold;">class</span>=<span style="color: #3366CC;">"gut"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;ul&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;li&gt;link&lt;/li&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/ul&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;/div&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/div&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;div <span style="color: #003366; font-weight: bold;">class</span>=<span style="color: #3366CC;">"tab"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;h3&gt;Tab <span style="color: #CC0000;color:#800000;">3</span>&lt;/h3&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;div <span style="color: #003366; font-weight: bold;">class</span>=<span style="color: #3366CC;">"gut"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;ul&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;li&gt;link&lt;/li&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/ul&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;/div&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/div&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/div&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>You will notice that there are no links for the tabs and this is because we will create them on the fly.  Why?  Well, other then that I have a plan to show you some new tricks, imagine that you have JavaScript turned off, those will just be pointless links with a hash in them.  You can probably argue that we can put an ID with each tab and that link will be a link hash to that ID, and I will say that you are being <span style="text-decoration: line-through;">brainwashed</span> educated to my thinking.</p>
<h3>The CSS</h3>
<p>This part is actually completely open to you to format how ever you want, my initial thought was to do a bunch of "progressive enhancements" - don't you love buzzwords for not truly supporting older browsers - that would entail some gradients, rounded corners and dropshadows, but the point of this post was not to show off my CSS3 prowest.  The point was to show you some fancy methods so here is the CSS I am using:</p>
<div class="igBar"><span id="lcss-41"><a href="#" onclick="javascript:showPlainTxt('css-41'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CSS:</span>
<div id="css-41">
<div class="css">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#sideTabs.closed<span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">left</span>:-310px;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#sideTabs<span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">position</span>:<span style="color: #993333;">fixed</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">left</span>:<span style="color: #cc66cc;color:#800000;">0</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">top</span>:100px;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">width</span>:300px;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">height</span>:300px;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">border</span>: 10px <span style="color: #993333;">solid</span> #000000;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">background</span>:#fff;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#sideTabs a.tabLinks<span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">position</span>:<span style="color: #993333;">absolute</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">right</span>:<span style="color: #cc66cc;color:#800000;">0</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">top</span>:<span style="color: #cc66cc;color:#800000;">0</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">outline</span>:<span style="color: #993333;">none</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">display</span>:<span style="color: #993333;">block</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">border</span>: 10px <span style="color: #993333;">solid</span> #000000;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; border-width<span style="color: #3333ff;">:1px </span>1px 1px 0px;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; -moz-border-radius: 0px 200px 200px 0px;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; -webkit-border-radius: <span style="color: #993333;">none</span> 200px 200px <span style="color: #993333;">none</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">margin</span>:<span style="color: #cc66cc;color:#800000;">0</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; padding<span style="color: #3333ff;">:<span style="color: #cc66cc;color:#800000;">0</span> </span>5px <span style="color: #cc66cc;color:#800000;">0</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">color</span>:#000;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">text-decoration</span>:<span style="color: #993333;">none</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">font</span>:12px/25px Verdana, Arial, Helvetica, <span style="color: #993333;">sans-serif</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">background</span>:#000;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">color</span>:#fff;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">z-index</span>:<span style="color: #cc66cc;color:#800000;">20</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#sideTabs a.tabLinks.active<span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; font<span style="color: #3333ff;">:<span style="color: #993333;">bold</span> </span>14px/25px Verdana, Arial, Helvetica, <span style="color: #993333;">sans-serif</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">background</span>:#fff;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">color</span>:#000;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">z-index</span>:<span style="color: #cc66cc;color:#800000;">21</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h3>The jQuery</h3>
<p>Alright, we are at the meat and potatoes the corn and the cob the Larry and Moe (and Curly)... sadly that is the best I can do with those analogies.  Any who, we are at the JavaScript, what I will do is post the code and the try to explain what is happening line by line:</p>
<div class="igBar"><span id="ljavascript-42"><a href="#" onclick="javascript:showPlainTxt('javascript-42'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-42">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> jqsideTabs;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> tabs, h = <span style="color: #CC0000;color:#800000;">50</span>, r = <span style="color: #CC0000;color:#800000;">0</span>,ra = <span style="color: #CC0000;color:#800000;">0</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span>document<span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">.<span style="color: #006600;">ready</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; jqsideTabs = $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#sideTabs'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">addClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'closed'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; tabs = jqsideTabs</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; .<span style="color: #006600;">find</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'.tab h3'</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; .<span style="color: #006600;">clone</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; .<span style="color: #006600;">appendTo</span><span style="color: #66cc66;">&#40;</span>jqsideTabs<span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; .<span style="color: #006600;">each</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>i<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> that = $<span style="color: #66cc66;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #66cc66;">&#41;</span>, cls = <span style="color: #3366CC;">''</span>,ow,newThis, newEl;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span> i == <span style="color: #CC0000;color:#800000;">0</span> <span style="color: #66cc66;">&#41;</span> cls = <span style="color: #3366CC;">' active'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; newEl = $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'&lt;a href=&quot;#&quot; class=&quot;tabLinks'</span>+cls+<span style="color: #3366CC;">'&quot;&gt;'</span> + that.<span style="color: #006600;">text</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> + <span style="color: #3366CC;">'&lt;/a&gt;'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; that.<span style="color: #006600;">replaceWith</span><span style="color: #66cc66;">&#40;</span>newEl<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; ow = newEl.<span style="color: #006600;">outerWidth</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span> i == <span style="color: #CC0000;color:#800000;">0</span> <span style="color: #66cc66;">&#41;</span> ra = ow;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">else</span> r = ow;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; h = newEl.<span style="color: #006600;">css</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span><span style="color: #3366CC;">'top'</span>:h , <span style="color: #3366CC;">'right'</span>: -ow <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">height</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> + h;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; newThis = newEl.<span style="color: #006600;">get</span><span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; newThis.<span style="color: #006600;">jq</span> = newEl;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; newThis.<span style="color: #006600;">i</span> = i;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; newEl.<span style="color: #006600;">click</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> el = <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">jq</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span> jqsideTabs.<span style="color: #006600;">hasClass</span><span style="color: #66cc66;">&#40;</span> <span style="color: #3366CC;">'closed'</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jqsideTabs.<span style="color: #006600;">removeClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'closed'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span> !jqsideTabs.<span style="color: #006600;">hasClass</span><span style="color: #66cc66;">&#40;</span> <span style="color: #3366CC;">'closed'</span> <span style="color: #66cc66;">&#41;</span> &amp;&amp; el.<span style="color: #006600;">hasClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'active'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jqsideTabs.<span style="color: #006600;">addClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'closed'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; el</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">siblings</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">removeClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'active'</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">css</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span><span style="color: #3366CC;">'right'</span>: -r <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">end</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">addClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'active'</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">css</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span><span style="color: #3366CC;">'right'</span>: -ra <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tabs.<span style="color: #006600;">eq</span><span style="color: #66cc66;">&#40;</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">i</span> <span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">show</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">siblings</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'.tab'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">hide</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; .<span style="color: #006600;">end</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; .<span style="color: #006600;">parent</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">eq</span><span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">addClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'active'</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; .<span style="color: #006600;">end</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">filter</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">':not(:eq(0))'</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">hide</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; .<span style="color: #006600;">end</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; jqsideTabs.<span style="color: #006600;">bind</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">"mouseleave"</span>,<span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; jqsideTabs</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">animate</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>left:-<span style="color: #CC0000;color:#800000;">310</span><span style="color: #66cc66;">&#125;</span>, <span style="color: #3366CC;">'fast'</span>, <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jqsideTabs.<span style="color: #006600;">addClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'closed'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">removeAttr</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'style'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p>
<strong>Update:</strong> <a href="http://www.benjaminsterling.com/wp-content/files/sidetab.htm" target="_blank">Moved the demo to a separate page.</a></p>
<h3>The Explanation</h3>
<p>Lines 1 and 2 are just some variables that I will be setting and reusing through-out the code.</p>
<p>Line 5 I set the "jqsideTabs" variable to reference the jQuery object for the element with an ID of sideTabs and I also add a class of "close".</p>
<p>Line 7 a reference is being set and I will point a little later below what that is actually being referenced too.</p>
<p>Line 8 we look inside the jqsideTabs DIV for the H3 elements that are inside the ".tab" DIVs.  I can just as easily do jqsideTabs.find('.tab &gt; h3') to make sure to the H3 tag directly below the ".tab" element or jqsideTabs.find('.tab h3<a href="http://docs.jquery.com/Selectors/firstChild" target="_blank">:first-child</a>') to make sure I grabbing the first H3 that is the first element under '.tab'.</p>
<p>Line 9 we <a href="http://docs.jquery.com/Manipulation/clone" target="_blank">clone()</a> those H3 elements, if we do <a href="http://docs.jquery.com/Manipulation/clone#true" target="_blank">.clone(true)</a> we will also clone any events that are bound to the H3.</p>
<p>Line 10 we append the cloned H3s to "jqsideTabs"</p>
<p>Line 11 through to 51 we are looping through those H3s to do some fanciness.  Notice the "i" in the function?  That will be returning the index of the loop starting at zero (0).</p>
<p>Line 12 some variables are set up.</p>
<p>Line 14 we check if we are on the first index, which is zero (0), and then set the "cls" variable to "active".</p>
<p>Line 15 we set up a reference to a new DOM element/jQuery object that has the text of the H3 element by using "that<a href="http://docs.jquery.com/Attributes/text" target="_blank">.text()</a>".</p>
<p>Line 16 we replace the H3 with the newly create DOM element, the A element/tag/</p>
<p>Line 18 we get the outer width (<a href="http://docs.jquery.com/CSS/outerWidth#options" target="_blank">.outerWidth()</a>) of the element, outerWidth() will get the full width of the element including border and padding, if you were to do outerWidth(true) you would also get the margins.</p>
<p>Line 20 we check if it is the first index again and if so, set the variable "ra" to the outer width</p>
<p>Line 21 is the else part of line 20 and here we set the "r" variable.  Both "ra" and "r" will be used for "right active" and "right".  You will see their purpose shortly.</p>
<p>Line 23 is doing a few things, 1) it is setting the top and right positions of the element and returning the <a href="http://docs.jquery.com/CSS/height" target="_blank">.height()</a> of the element plus the previously stored height at the same time.</p>
<p>Line 25 we are using the <a href="http://docs.jquery.com/Core/get#index" target="_blank">.get(0)</a> method against the newly created A tag and this will give us the equivalent of doing a getElementById.</p>
<p>Line 26 we set the reference now so that we don't have to re-look up this element later on, the speed gain is probably minimum at best but I makes me happy to do this and really, that is what it's all about.</p>
<p>Line 27 and line 26 we are doing something specific and really can't remember what it is called, maybe "assignment," but basically we are storing some data directly in the DOM to be used later.</p>
<p>Line 29 we add a <a href="http://docs.jquery.com/Events/click#fn" target="_blank">.click()</a> event to the A tag we created.</p>
<p>Line 30 just to stick to a decent naming conventions I take the varariable I set earlier and plop it into a new variable call "el" (short for element)</p>
<p>Line 32 to 34 we check to see if the jqsideTabs element has a class (<a href="http://docs.jquery.com/Traversing/hasClass#class" target="_blank">.hasClass()</a>) of "closed", if so, remove that class.</p>
<p>Line 35 to 37 we check to see if the jqsidetabs element <strong>does not have</strong> a class of "closed" and the current element has a class of "active", if so, add the class "close".</p>
<p>Line 40 we grab all the <a href="http://docs.jquery.com/Traversing/siblings#expr" target="_blank">.siblings()</a>, in this case, all the .tab DIVs and links that were created.</p>
<p>Line 41 each item returns will have the class "active" removed.</p>
<p>Line 42 the default right position is set for those elements.  But let me note something real quick, in this case I am going with the assumption that I did not set the "position" of the .tab elements to anything, meaning, they were not set to relative or absolute.  If I did this I would need to change siblings to only grab items at are A tags to be sure I only grab the, well, A tags.</p>
<p>Line 43 the <a href="http://docs.jquery.com/Traversing/end" target="_blank">.end()</a> method is used, this brings the reference back to "el" at line 39.</p>
<p>Line 44 a class of "active" is added.</p>
<p>Line 45 the right position is set to the "ra" variable.</p>
<p>Line 47 with the reference of tabs that was set back at line 7, we find the DIV or .tab that equals what ever that index (i) is match to, in the example it can be either 0, 1 or 2, then we show that one and then hide its siblings that have a class of ".tab".</p>
<p>Line 49 a return of false is used to stop the default action of the link.</p>
<p>Line 52 end() is used to give reference back to the H3 tags.</p>
<p>Line 53 we use <a href="http://docs.jquery.com/Traversing/parent#expr" target="_blank">.parent()</a> to grab the parents of the H3 tags.</p>
<p>Line 54 we filter down to the first element in the parents by using .eq(0).</p>
<p>Line 55 a class is added to that returned element from line 54.</p>
<p>Line 56 we go back to all the parents by using .end()</p>
<p>Line 57 filter is used with the combination seletor of "<a href="http://docs.jquery.com/Selectors/not#selector" target="_blank">:not()</a>" and ":eq(0)" to grab all the DIVs (the parents of the H3s) that is not equal to the first one.</p>
<p>Line 58 then we hide the returned elements</p>
<p>Line 59 here we use end() to finally set the "tabs" variable that we have way back at line 7.</p>
<h3>The Closing</h3>
<p>Ok, are you <span style="text-decoration: line-through;">brainwashed</span> educated yet?  Could I have combined a few steps or could I have writen some of my selectors to be a little more precise? Sure I could have.  The beauty of coding with jQuery is that there can be any number of ways to approach the same exact issue.  But do keep in mind that my way is always the right way.</p>
<p>But seriously, there are a lot of ways to use the jQuery framework, you have to find the way the best suits you.  And the only way to find that out is to learn how others do it and read the docs and learn the <a href="http://docs.jquery.com/Selectors" target="_blank">selectors</a> and <a href="http://docs.jquery.com/Traversing" target="_blank">traversing</a> methods.</p>
<p>As always, please feel free to check me if I got something incorrect or if you think you can do better.  I am just as open to learning as you should be.</p>
]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/slide-in-tab-window-using-jquery/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Web Tech November Meetup</title>
		<link>http://benjaminsterling.com/web-tech-november-meetup/</link>
		<comments>http://benjaminsterling.com/web-tech-november-meetup/#comments</comments>
		<pubDate>Wed, 19 Nov 2008 15:27:16 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
				<category><![CDATA[Presentations]]></category>
		<category><![CDATA[Ramblings]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/?p=103</guid>
		<description><![CDATA[Well ladies and Gents, looks like I will be doing another jQuery presentation at the Web Tech November Meetup at the "Investors United Baltimore Campus" on the 24th of November.
The presentation will break from the normal jQuery presentations you see on the web and will be approached in the way I explain jQuery to co-workers, [...]]]></description>
			<content:encoded><![CDATA[<p>Well ladies and Gents, looks like I will be doing another jQuery presentation at the Web Tech November Meetup at the "<a href="http://maps.google.com/maps?q=6721+Harford+Rd.+Baltimore,+MD+21234&amp;ie=UTF8&amp;oe=utf-8&amp;client=firefox-a&amp;ll=39.370801,-76.528702&amp;spn=0.118637,0.264359&amp;z=13&amp;iwloc=addr">Investors United Baltimore Campus</a>" on the 24th of November.</p>
<p>The presentation will break from the normal jQuery presentations you see on the web and will be approached in the way I explain jQuery to co-workers, people through my site, or Tweeter.  I will point you to the resources you need to know about and get familiar with, which all presentations do.  But I will not be giving you the history of jQuery, I don't believe people come to these presentations or meetups to learn the history of something, they want to know how it works.  And that is what I will tell you, how jQuery works with in the context of your everyday projects.  I will give you some tips on how to structure your code, what selectors are faster and how to use some of those <a href="http://docs.jquery.com/Traversing">fancy traversing methods</a>.</p>
<p>I have not decide exactly which methods to focus on, I am still research which ones I really use most often and which ones other developers use most often.  But be sure that the ones I pick will be ones that you will start using immediately.</p>
<p>So come on out and see me ramble on on how good jQuery is or just come out to see how sexy i really am, it will be a good time either way.</p>
<p><a href="http://www.meetup.com/webdevelopment/calendar/9134655/">Be sure to RSVP!</a></p>
]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/web-tech-november-meetup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Better jQuery Code #2</title>
		<link>http://benjaminsterling.com/better-jquery-code-2/</link>
		<comments>http://benjaminsterling.com/better-jquery-code-2/#comments</comments>
		<pubDate>Sun, 16 Nov 2008 16:00:17 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/?p=101</guid>
		<description><![CDATA[In a follow up to my Better jQuery Code #1 post I will be writing about some other small items that I have found to make my code better and more readable.
Chaining
Chaining is one of the most beautiful and time save pieces of code structure that jQuery brought to the game, the problem is is [...]]]></description>
			<content:encoded><![CDATA[<p>In a follow up to my <a href="http://benjaminsterling.com/better-jquery-code-1/">Better jQuery Code #1</a> post I will be writing about some other small items that I have found to make my code better and more readable.</p>
<h3>Chaining</h3>
<p>Chaining is one of the most beautiful and time save pieces of code structure that jQuery brought to the game, the problem is is that it can make the code unreadable if not treated correctly.</p>
<p>For example, say you wanted to select the fourth LI in your nav and add a class, remove a class from it, then you want to find the UL that is a child of that LI and add a class to that, then want to move back to the UL that has the ID nav on it (.end() goes back to the last 'destructive' operation) and lastly you want to animate that UL.  Along with have a heft run on sentence you also have a pretty unreadable string of functions.</p>
<div class="igBar"><span id="ljavascript-53"><a href="#" onclick="javascript:showPlainTxt('javascript-53'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-53">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#nav'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">find</span><span style="color: #66cc66;">&#40;</span>&amp;gt; li<span style="color: #3366CC;">').eq(3).addClass('</span>className<span style="color: #3366CC;">').removeClass('</span>otherClass<span style="color: #3366CC;">').find('</span>ul<span style="color: #3366CC;">').addClass('</span>redClass<span style="color: #3366CC;">').end().end().end().slideUp().slideDown(); </span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Instead, format you code to look something like below, you can have more then one methods per line, but keep it reasonable and readable.  See how I am indenting each line?  This is to give it a sense that each method is referring to specific elements.  Much like you would indent your HTML and how some people indent their related CSS, it is good practice to indent your code.</p>
<div class="igBar"><span id="ljavascript-54"><a href="#" onclick="javascript:showPlainTxt('javascript-54'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-54">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#nav'</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; .<span style="color: #006600;">find</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'&gt; li'</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">eq</span><span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;color:#800000;">3</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">addClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'className'</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">removeClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'otherClass'</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">find</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'ul'</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">addClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'redClass'</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">end</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; .<span style="color: #006600;">end</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">.<span style="color: #006600;">end</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">.<span style="color: #006600;">slideUp</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">.<span style="color: #006600;">slideDown</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>A small caveat to the above structure is that if you run your code through <a href="http://www.javascriptlint.com/online_lint.php">JavaScript Lint</a> you will get a notice of "lint warning: unexpected end of line; it is ambiguous whether these lines are part of the same statement," I personally don't see an issue with this and will just to a find and replace for the line break and all is good.</p>
<h3>Traversing (Finding)</h3>
<p><a href="http://benjaminsterling.com/better-jquery-code-1/"><br />
Last post I posted about <strong>eq, hasClass, is, and not</strong></a> which are four traversing methods for filtering out certain items from your select.  For returning specific elements from the DOM using the <a href="http://docs.jquery.com/Traversing/children#expr" target="_blank">children()</a>, <a href="http://docs.jquery.com/Traversing/siblings" target="_blank">siblings()</a>, <a href="http://docs.jquery.com/Traversing/parent#expr" target="_blank">parent()</a>, and <a href="http://docs.jquery.com/Traversing/parents#expr" target="_blank">parents()</a> methods in most of my projects.</p>
<blockquote class="quote"><p>The Core developers for jQuery are very smart people</p></blockquote>
<p>The Core developers for jQuery are very smart people, they name methods the make a lot of sense and match up to the functionality they provide and <strong>children()</strong> is not an exception.  Let's assume we have the following DOM structure:</p>
<div class="igBar"><span id="ljavascript-55"><a href="#" onclick="javascript:showPlainTxt('javascript-55'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-55">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;ul id=<span style="color: #3366CC;">"nav"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;li&gt;&lt;a&gt;Text&lt;<span style="color: #0066FF;">/a&gt;&lt;/</span>li&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;li&gt;&lt;a&gt;Text&lt;<span style="color: #0066FF;">/a&gt;&lt;/</span>li&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;li&gt;&lt;a&gt;Text&lt;<span style="color: #0066FF;">/a&gt;&lt;/</span>li&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;li&gt;&lt;a&gt;Text&lt;<span style="color: #0066FF;">/a&gt;&lt;/</span>li&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;li&gt; &lt;a&gt;Text&lt;/a&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;ul&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;li&gt;&lt;a&gt;text&lt;<span style="color: #0066FF;">/a&gt;&lt;/</span>li&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/ul&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/li&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;li&gt;&lt;a&gt;Text&lt;<span style="color: #0066FF;">/a&gt;&lt;/</span>li&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;li&gt;&lt;a&gt;Text&lt;<span style="color: #0066FF;">/a&gt;&lt;/</span>li&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/ul&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>With that structure, we did:</p>
<div class="igBar"><span id="ljavascript-56"><a href="#" onclick="javascript:showPlainTxt('javascript-56'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-56">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#nav'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">children</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>How many elements would be returned? 17? 15? 7?</p>
<p>If you said 7 then you are correct; why not 17 or 15?  Imagine this, you have a single parent, and you have 6 brothers each of whom have a significant other.  You and your significant other have a daughter and she in turns has a kid but is single and that kid has a childhood sweetheart.  In this scenario "#nav" is your mother (we'll cover the parent and parents method below but keep this in your head) and when we say give me all your children we are only look for your mothers immediate children, which in this case are the LI.</p>
<p>Got that?</p>
<p>Ok, now what do you get if you do the following with the <strong>siblings()</strong> method?</p>
<div class="igBar"><span id="ljavascript-57"><a href="#" onclick="javascript:showPlainTxt('javascript-57'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-57">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'li:eq(4)'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">siblings</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>If you said 6, you are correct, siblings will select all your immediate brothers and sisters.  You following me so far?  Does this make sense?  In this example we are saying select the LI that is in the forth index (or in this case, you) and then get my brothers and sisters or siblings.</p>
<p>Just for a teaser, what if you wanted to something to you and your siblings?  Easy, just add<strong> .andSelf()</strong> at the end (this would probably be used in a case where you click on a LI and do $(this)).  We'll cover this a bit more in a later post.</p>
<div class="igBar"><span id="ljavascript-58"><a href="#" onclick="javascript:showPlainTxt('javascript-58'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-58">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'li:eq(4)'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">siblings</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">andSelf</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The <strong>.parent()</strong> method is pretty straight forward, it will select your immediate parent.  So in the following case you will select the UL.</p>
<div class="igBar"><span id="ljavascript-59"><a href="#" onclick="javascript:showPlainTxt('javascript-59'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-59">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'li:eq(4)'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">parent</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The <strong>parent() </strong>method excepts an expression but the only need I've ever had was to quickly test the parent for something particular, maybe a class or a specific attribute or attribute with a certain value, in an IF statement. (remember, in JavaScript 0 is treated at false and 1 is treated as true)</p>
<div class="igBar"><span id="ljavascript-60"><a href="#" onclick="javascript:showPlainTxt('javascript-60'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-60">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span> $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'li:eq(4)'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">parent</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'.selected'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span> $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'li:eq(4)'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">parent</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'[data]'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span> $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'li:eq(4)'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">parent</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'[start=5]'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The <strong>parents()</strong> method can be a little more powerful for your needs, but is useful in some cases.  Let's assume that the UL above is the only code in your body tag.  So if you do the following how many items will be returned? 1? 2? 3? 4?</p>
<div class="igBar"><span id="ljavascript-61"><a href="#" onclick="javascript:showPlainTxt('javascript-61'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-61">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'li:eq(4)'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">parents</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>If you said anything but 3 you would be incorrect, if the UL code above was the only child of the body tag that the JavaScript code above would return the UL, BODY, and HTML tags.  With the parents method you can filter it down to what you want by using any number of selectors that jQuery supports.</p>
<p>Below is a piece of code from a project I've been working on.  Basically the issue was that there needed to be a submit button appended after the last input box on the page. If that input box is inside of table, append the button after the table.  The issue was, I had not idea what the TABLE may be in, could have been a DIV that is inside of a DIV and so on.  Also keep in mind that as of this writing I see at least one better way to have written out this code but for this post this example should work fine.</p>
<div class="igBar"><span id="ljavascript-62"><a href="#" onclick="javascript:showPlainTxt('javascript-62'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-62">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">// inlineTextQuestion is a reference to all the input elements</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> lastOne = inlineTextQuestion.<span style="color: #006600;">eq</span><span style="color: #66cc66;">&#40;</span> inlineTextQuestion.<span style="color: #006600;">size</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>-<span style="color: #CC0000;color:#800000;">1</span> <span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> lastOneParents = lastOne.<span style="color: #006600;">parents</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> lastOneParent = <span style="color: #003366; font-weight: bold;">null</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">lastOneParents</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">.<span style="color: #006600;">each</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>i<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span> lastOneParent === <span style="color: #003366; font-weight: bold;">null</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> el = $<span style="color: #66cc66;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// #bodyText is the one known factor I had</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span> el.<span style="color: #006600;">parent</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #000066; font-weight: bold;">is</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#bodyText'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lastOneParent = el;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">// sbmt is a reference to a submit button create about this code</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">lastOneParent.<span style="color: #006600;">after</span><span style="color: #66cc66;">&#40;</span>sbmt<span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Let me try to explain what is going on, please refer to the comments in the code for what the variables are reference to, line 2 I am grabbing a reference to the last INPUT in the inlineTextQuestion variable.  Line 3 I grabbed a reference to the all the parents of that INPUT.  Line 6/7 I loop through all the parents checking , at line 11, to see if the current element's parent is the DIV with the ID of "bodyText."  If that returns true we set a reference to that element and at line 18 I append the submit button after that referenced element.</p>
<h3>Closing</h3>
<p>In this post we discussed using the <a href="http://docs.jquery.com/Traversing/children#expr" target="_blank">children()</a>, <a href="http://docs.jquery.com/Traversing/siblings" target="_blank">siblings()</a>, <a href="http://docs.jquery.com/Traversing/parent#expr" target="_blank">parent()</a>, and <a href="http://docs.jquery.com/Traversing/parents#expr" target="_blank">parents()</a> methods and I try to explain them the way I see them.  These are the ones I use the most and the ones I think you will find the love for.</p>
<p>If there is anything with the above you don't under stand or, god forbid, I got incorrect, please feel free to drop me a line.</p>
]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/better-jquery-code-2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Better jQuery Code #1</title>
		<link>http://benjaminsterling.com/better-jquery-code-1/</link>
		<comments>http://benjaminsterling.com/better-jquery-code-1/#comments</comments>
		<pubDate>Sat, 15 Nov 2008 18:01:50 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/?p=99</guid>
		<description><![CDATA[

I've been wanting to write some jQuery tips for a while now and just never know what to really say until I saw Marc Grabanski's 5 Tips for Better jQuery Code.  Although I have tips, I don't think I have any that are Earth shattering or ones that I can rank higher then the other, [...]]]></description>
			<content:encoded><![CDATA[<div class="featureImg"><img class="alignnone size-full wp-image-100" title="jquery_logo_color_onwhite" src="http://benjaminsterling.com/wp-content/uploads/2008/11/jquery_logo_color_onwhite.png" alt="" width="610" /></div>
<p><br/></p>
<p>I've been wanting to write some jQuery tips for a while now and just never know what to really say until I saw <a title="5 Tips for Better jQuery Code" href="http://marcgrabanski.com/article/5-tips-for-better-jquery-code" target="_blank">Marc Grabanski's 5 Tips for Better jQuery Code</a>.  Although I have tips, I don't think I have any that are Earth shattering or ones that I can rank higher then the other, but these are ones that I use daily and are asked about just as often.</p>
<h3>Caching</h3>
<p>If there are items you will be referencing more than once, cache it!  Even if you won't be referencing an item more than once still get in the habit of setting up references.</p>
<p>Now, what do I mean references?  If you are going to be playing with you main nav group or probably going to be messing with inputs, set up a variable and store the reference to those element in it.</p>
<div class="igBar"><span id="ljavascript-71"><a href="#" onclick="javascript:showPlainTxt('javascript-71'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-71">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> mainNav = $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#main_nav a'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> inputs = $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'input'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">// the make calls like</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mainNav.<span style="color: #006600;">click</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">input.<span style="color: #006600;">change</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>[Update #1: as <a href="http://benjaminsterling.com/better-jquery-code-1/#comment-5149">Sean O</a> points out, doing $mainNav may help you remember that the variable is a jQuery object and may be good practice.]</p>
<p>[Update #2: Another good point from <a href="http://benjaminsterling.com/better-jquery-code-1/#comment-5151">Dan G. Switzer</a>, you could easily have cached your jQuery objects when you initiated your events/behaviors like below]</p>
<div class="igBar"><span id="ljavascript-72"><a href="#" onclick="javascript:showPlainTxt('javascript-72'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-72">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> $mainNav = $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#mainNav'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">click</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h3>Traversing (Filtering)</h3>
<p>This is a topic I plan to put some more effort into in a later post but there are four methods you should use: <strong><a href="http://docs.jquery.com/Traversing/eq#index" target="_blank">eq</a>, <a href="http://docs.jquery.com/Traversing/hasClass#class" target="_blank">hasClass</a>, <a href="http://docs.jquery.com/Traversing/is#expr" target="_blank">is</a>, and <a href="http://docs.jquery.com/Traversing/not#expr" target="_blank">not</a></strong>.</p>
<p>The use of these methods will filter out your selection to mat</p>
<div class="igBar"><span id="ljavascript-73"><a href="#" onclick="javascript:showPlainTxt('javascript-73'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-73">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> mainNav = $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#main_nav a'</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>eq()</strong> will filter your selection down to one element <strong>eq(1)</strong> will select the second element since the jQuery object that is returned by $('#main_nav a') is basically a zero based array.</p>
<div class="igBar"><span id="ljavascript-74"><a href="#" onclick="javascript:showPlainTxt('javascript-74'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-74">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mainNav.<span style="color: #006600;">eq</span><span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>A combination of <strong>eq </strong>and <strong>hasClass</strong>; <strong>hasClass </strong>is exacly what it sounds like, it checks the element to see if it has a class of "selected" and returns true if it does have that class</p>
<div class="igBar"><span id="ljavascript-75"><a href="#" onclick="javascript:showPlainTxt('javascript-75'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-75">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mainNav.<span style="color: #006600;">eq</span><span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">hasClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'selected'</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Once again, a combination of <strong>eq </strong>and <strong>is</strong>; <strong>is </strong>simply checks the element in question against the expression in the brackets and returns true if is has the class selected or if the tag is A</p>
<div class="igBar"><span id="ljavascript-76"><a href="#" onclick="javascript:showPlainTxt('javascript-76'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-76">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mainNav.<span style="color: #006600;">eq</span><span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #000066; font-weight: bold;">is</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'.selected'</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #009900; font-style: italic;">// checks for class of selected</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mainNav.<span style="color: #006600;">eq</span><span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #000066; font-weight: bold;">is</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'a'</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #009900; font-style: italic;">// checks to see element is an A tag </span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Checks to see if element has text in it of "special text" returns true if it has that text</p>
<div class="igBar"><span id="ljavascript-77"><a href="#" onclick="javascript:showPlainTxt('javascript-77'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-77">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mainNav.<span style="color: #006600;">eq</span><span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #000066; font-weight: bold;">is</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">':contains(special text)'</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>.not()</strong> will return elements that do <strong>not</strong> match the expression.</p>
<div class="igBar"><span id="ljavascript-78"><a href="#" onclick="javascript:showPlainTxt('javascript-78'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-78">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mainNav.<span style="color: #006600;">not</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'.active'</span><span style="color: #66cc66;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>So if you were to put a class of active on one of the links, that call will return all links in mainNav that you did <strong>not </strong>put a class of active.</p>
<h3>Closing</h3>
<p>Ok, I wanted to keep this short and point out some of the items I personally deal with and some items that I get asked about daily.  There are a few other items that I will address in another post that will make your life easier.</p>
<p>If there is anything with the above you don't under stand or, god forbid, I got incorrect, please feel free to drop me a line.</p>
]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/better-jquery-code-1/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Learning from your mistakes</title>
		<link>http://benjaminsterling.com/learning-from-your-mistakes/</link>
		<comments>http://benjaminsterling.com/learning-from-your-mistakes/#comments</comments>
		<pubDate>Wed, 15 Oct 2008 04:10:50 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
				<category><![CDATA[Ramblings]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/?p=95</guid>
		<description><![CDATA[
credit: AdamNF
Imagine this, you are a seasoned web developer and have encountered just about every situation as a developer.  Now imagine that an unseasoned developer, not quite under your care, stresses that something that is overly basic - as a seasoned developer it would be overly basic - can't be done or require just way [...]]]></description>
			<content:encoded><![CDATA[<div class="featureImg"><a href="http://benjaminsterling.com/wp-content/uploads/2008/10/2424992539_5caf3d4e61.jpg"><img class="aligncenter size-full wp-image-96" title="ARG!" src="http://benjaminsterling.com/wp-content/uploads/2008/10/2424992539_5caf3d4e61.jpg" border="0" alt="Frustration" width="610" /></a></div>
<p style="text-align:right;">credit: <a href="http://flickr.com/photos/adampenney/">AdamNF</a></p>
<p>Imagine this, you are a seasoned web developer and have encountered just about every situation as a developer.  Now imagine that an unseasoned developer, not quite under your care, stresses that something that is overly basic - as a seasoned developer it would be overly basic - can't be done or require just way to much time to achieve.  Now imagine since this developer can't (or won't) do this overly simple task you now have to take this project on your shoulders and spend countless hours recoding close to 500 lines of code plus add an extra 300 lines of bloat - all of which are against your better judgment and coding philosophy -  to achieve the goals for this project.   How would you react?  What would you do?  Well, I will tell you how I originally reacted and what I eventually did.</p>
<blockquote class="quote"><p>My initial reaction was poor, very poor and embarrassing, I flipped out and stopped short of calling him name.</p></blockquote>
<p>My initial reaction was poor, very poor and embarrassing, I flipped out and stopped short of calling him name.  I did yell, which I never do.  When the project was start all requirements were laid out and I explicitly told the developer exactly what I needed and made him repeat those needs back to me.  I also ask him what he need from me and I confirmed those items with him in emails, in person and on conference calls.  So when you get a call on a Sunday afternoon stating that you have recode code that has been done for over a month and a half that has been tested and was working a 100%,  getting mad is just about all you can do.  So I yelled and cursed; recited email after email, notes after notes about prior discussions and what was agreed on.</p>
<p>Like I said, reacted very poorly.  After this call I stepped outside to collect myself and get my thoughts together.  Once I calmed down I decided that I would treat this situation as if I were back being a supervisor at <abbr title="United Parcel Service">UPS</abbr>.  What made me one of the best - if not the best - supervisors at UPS was my ability to train, cross-train, communicate and making my employees think that my ideas were actually their ideas.</p>
<blockquote class="quote"><p>...debating only waste time and will frustrate you.</p></blockquote>
<p>I went ahead and did all the recoding and set things up to have this developer come up with my ideas.  At UPS having someone come up with your idea was pretty easy, it's manual labor so convincing someone to do something smart not hard is quite simple.  Convincing a person that sits in front of a keyboard that you never see (I telecommute) to work smarter, not harder is complicated.  I had to keep in constant communication with him and our supervisor - our supervisor works in the office with him and can relay messages to him without making it seem like it came from me.  In these communications I had to bring up a small problem that only really had one outcome and would be the outcome I was looking for.  Much like a lawyer should never ask a question they don't already know the answer too, I made sure to ask questions that only benefited my philosophy.  I tried to stay away from items that I knew would cause a debate, even if in my mind it was a simple topic, debating only waste time and will frustrate you.</p>
<p>After about three weeks - yes, three weeks is a long time but keep in mind that I don't see this person everyday and I am working four other projects so very little time to focus - we were getting complaints that the app was moving too slow.  Which was one of the seeds I was planting over the three weeks was about load time and processing time.  I had gone into the office to discuss everything face to face with him and our supervisor to see "what we can do to fix it."  I had planted quite a few seeds so all I really needed to do at this point was to add water.  Water in this instance was me walking thru that app looking ever-so frustrated that I could not come up with an answer on fixing it.  I start out by pointing out the the obvious, the page took too long to load and once we were sure everything was loaded there was still a hand in the app.  The load time was do to a massive XML document being loaded, well over 4,000 lines, and the hand was the bloated code I needed to put in to achieve what this developer could not do on his end.</p>
<p>Before I go further, let me clear up who is doing what.  I am, on this project, the front end developer dealing with the JavaScript framework I build on top of jQuery, building out the design and making it 508 compliant.  He is building a CMS of sorts to maintain and track the content.  When I say track, I mean the content can be versioned and have comments for changes appended to it.  He is building everything out in ASP.NET.</p>
<blockquote class="quote"><p>...sometimes you have to baby step people till the see the big picture.</p></blockquote>
<p>After pointing out exact what might be causing the load time and the hand, xml and the code bloat, I suggested something simple for the load time in the form of a question to the developer.  "What would happen if we shrunk the tag name for one specific tag in the XML down to one letter?"  He was like "Hmmm... the change would be pretty easy on my end, maybe we comment out some attributes that are not needed."  And that is where he started taking off with the idea (please note, this was one of the ideas I've been pushing from the very beginning but its only a band-aide to a bigger problem.  Baby steps.) and shrinking the other tags.  Basically were shrank a 500kb file down to 250kb, not great, but a huge improvement, remember, sometimes you have to baby step people till the see the big picture.</p>
<p>Once we got that particular issue "resolved" it was time to move onto issue two, the code bloat.  When I coded this I made sure to make it expendable, the moment it was not needed anymore it was gone.  The framework basically works off the hash by default, much like gmail does so you can go back and forth in your history.  But instead of sending me the hash as my code expects, he was sending me an ID of the page and I had to transverse the XML to build out the needed hash.  But before I had the chance to start explaining the problem and how we "might" resolve it he blurts out "Oh, I think I can just send you the hash.  Shouldn't be to hard."  I litterally sat there with my mouth open for what felt like an hour.  To rehash, the number one issue that he was unable to do was the building out of the hash.  For those that don't know, a hash is what you see in your URI (#somehash).  In our case, the hash looks like #m-1000-0-0-0 which is #m-Module-lesson-topic-page; its zero based so 0 is the first lesson/topic/page, 1 is the second and so on.</p>
<p>So what did we learn here?  Well, a few things.</p>
<p><strong>For Senior Developers:</strong></p>
<ol>
<li>Communicate</li>
<li>Be willing to let the unseasoned learn from their own mistakes.  You may need to take a hit every now and then but in the end the unseasoned will become season and an asset.</li>
<li>You are allowed to get mad and frustrated, but keep your composure.  Step outside and take a breather if you need, but keep your cool and be a leader.</li>
<li>You made your mistakes to get where you are at, so remember that when the unseasoned make a mistake that makes your work harder to do.</li>
<li>Be willing to teach, that kinda goes hand in hand with letting the unseasoned make mistakes, but the difference here is preemptive.  If you have an opportunity to truly explain why something is done a certain way, do it.</li>
</ol>
<p><strong>For Juniour/Entry level Developers</strong></p>
<ol>
<li>Communicate</li>
<li>Learn from your mistakes; don't make the same ones over and over again.</li>
<li>Understand that people will get frustrated with you if you "don't know everything they know."  But be willing to ask for help.  99% of the time that will bring the frustration level down and give them an ego boost.</li>
<li>This one bares repeating: Learn from your mistakes; don't make the same ones over and over again.</li>
<li>Be willing to learn.  Simple as that.  You don't know everything and there is always someone, even for seasoned developers, that knows much more than you.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/learning-from-your-mistakes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress: Getting all post between two dates</title>
		<link>http://benjaminsterling.com/wordpress-getting-all-post-between-to-dates/</link>
		<comments>http://benjaminsterling.com/wordpress-getting-all-post-between-to-dates/#comments</comments>
		<pubDate>Sun, 04 May 2008 17:00:48 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/?p=65</guid>
		<description><![CDATA[Today I had a need to get all posts between to dates in WordPress, between now and a year ago.  After searching and searching I could find the answer I needed.  So I decided to just write the query myself which I have done many times before but not with WordPress' database scheme.]]></description>
			<content:encoded><![CDATA[<p>Today I had a need to get all posts between to dates in WordPress, between now and a year ago.  After searching and searching I could find the answer I needed.  So I decided to just write the query myself which I have done many times before but not with WordPress' database scheme.</p>
<p>Below is the code that I used, basically I need to grab all posts from a particular category, in this case category 3, and I also needed the posts to be between today's date and this date last year.  Some help came from this <a href="http://codex.wordpress.org/Displaying_Posts_Using_a_Custom_Select_Query" rel="nofollow">post here</a>.</p>
<p>Well, here it is:</p>
<div class="igBar"><span id="lphp-79"><a href="#" onclick="javascript:showPlainTxt('php-79'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-79">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$querystr</span> = <span style="color:#FF0000;">"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&nbsp; &nbsp; SELECT * </span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&nbsp; &nbsp; FROM $wpdb-&gt;posts as wpost</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&nbsp; &nbsp; INNER JOIN $wpdb-&gt;term_relationships </span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&nbsp; &nbsp; ON (wpost.ID = $wpdb-&gt;term_relationships.object_id) </span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&nbsp; &nbsp; INNER JOIN $wpdb-&gt;term_taxonomy </span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&nbsp; &nbsp; ON ($wpdb-&gt;term_relationships.term_taxonomy_id = $wpdb-&gt;term_taxonomy.term_taxonomy_id)</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&nbsp; &nbsp; AND $wpdb-&gt;term_taxonomy.taxonomy = 'category'</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&nbsp; &nbsp; AND $wpdb-&gt;term_taxonomy.term_id IN (3)</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&nbsp; &nbsp; where wpost.post_date BETWEEN SUBDATE(CURDATE(), INTERVAL 1 YEAR) and ADDDATE(CURDATE(), INTERVAL 1 DAY) ORDER BY wpost.post_date DESC</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;"> "</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$pageposts</span> = <span style="color:#0000FF;">$wpdb</span>-&gt;<span style="color:#006600;">get_results</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$querystr</span>, OBJECT<span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/wordpress-getting-all-post-between-to-dates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
