<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>Dev7studios</title>
	
	<link>http://dev7studios.com</link>
	<description>Just another WordPress site</description>
	<lastBuildDate>Wed, 25 Aug 2010 09:59:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/dev7studios" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="dev7studios" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Ultimate WordPress Description META Tag Code</title>
		<link>http://dev7studios.com/resource/ultimate-wordpress-description-meta-tag-code/</link>
		<comments>http://dev7studios.com/resource/ultimate-wordpress-description-meta-tag-code/#comments</comments>
		<pubDate>Wed, 25 Aug 2010 09:59:03 +0000</pubDate>
		<dc:creator>gilbitron</dc:creator>
				<category><![CDATA[Resource]]></category>

		<guid isPermaLink="false">http://dev7studios.com/?p=215</guid>
		<description><![CDATA[According to this post WordPress does not include description and keyword meta tags by default. Their reasoning for this is simple: the information is unique to your site and should therefore be included by yourself. Now this is fine except when you forget to add your own meta tags or you just can’t be bothered [...]]]></description>
			<content:encoded><![CDATA[<p>According to <a href="http://codex.wordpress.org/Meta_Tags_in_WordPress">this post</a> WordPress does not include description and keyword meta tags by default. Their reasoning for this is simple: the information is unique to your site and should therefore be included by yourself.</p>
<p>Now this is fine except when you forget to add your own meta tags or you just can’t be bothered adding them yourself (which is bad for your SEO). So below is a simple bit of code to put in your themes <strong>header.php</strong> file wherever you would normally put your meta tags.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;meta name=&quot;description&quot; content=&quot;'</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> is_single<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> is_page<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$meta_description</span> <span style="color: #339933;">=</span> get_post_meta<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;metadescription&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$meta_description</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">''</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$content</span> <span style="color: #339933;">.=</span> esc_attr<span style="color: #009900;">&#40;</span><span style="color: #000088;">$meta_description</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> have_posts<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span> have_posts<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> the_post<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$excerpt</span> <span style="color: #339933;">=</span> esc_attr<span style="color: #009900;">&#40;</span><span style="color: #990000;">strip_tags</span><span style="color: #009900;">&#40;</span>get_the_excerpt<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$excerpt</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">140</span> <span style="color: #009900;">&#41;</span> <span style="color: #000088;">$excerpt</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$excerpt</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">137</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">'...'</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$content</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$excerpt</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elseif</span><span style="color: #009900;">&#40;</span> is_home<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> is_front_page<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$content</span> <span style="color: #339933;">.=</span> get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'description'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elseif</span><span style="color: #009900;">&#40;</span> is_category<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$cat_desc</span> <span style="color: #339933;">=</span> esc_attr<span style="color: #009900;">&#40;</span><span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">strip_tags</span><span style="color: #009900;">&#40;</span>category_description<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cat_desc</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span>
        <span style="color: #000088;">$content</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$cat_desc</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">else</span>
        <span style="color: #000088;">$content</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'Archive for the category '</span><span style="color: #339933;">.</span> single_cat_title<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elseif</span><span style="color: #009900;">&#40;</span> is_tag<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$tag_desc</span> <span style="color: #339933;">=</span> esc_attr<span style="color: #009900;">&#40;</span><span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">strip_tags</span><span style="color: #009900;">&#40;</span>tag_description<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tag_desc</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span>
        <span style="color: #000088;">$content</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$tag_desc</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">else</span>
        <span style="color: #000088;">$content</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'Archive for the tag '</span><span style="color: #339933;">.</span> single_tag_title<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elseif</span><span style="color: #009900;">&#40;</span> is_author<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'author_name'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #000088;">$curauth</span> <span style="color: #339933;">=</span> get_user_by<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'slug'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$author_name</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">else</span>
        <span style="color: #000088;">$curauth</span> <span style="color: #339933;">=</span> get_userdata<span style="color: #009900;">&#40;</span><span style="color: #990000;">intval</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$author</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$content</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'Archive for the author '</span><span style="color: #339933;">.</span> <span style="color: #000088;">$curauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">display_name</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elseif</span><span style="color: #009900;">&#40;</span> is_year<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$content</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'Archive for '</span> <span style="color: #339933;">.</span> get_the_time<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Y'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elseif</span><span style="color: #009900;">&#40;</span> is_month<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$content</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'Archive for '</span> <span style="color: #339933;">.</span> get_the_time<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'F, Y'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elseif</span><span style="color: #009900;">&#40;</span> is_day<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$content</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'Archive for '</span> <span style="color: #339933;">.</span> get_the_time<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'jS F, Y'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000088;">$content</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&quot; /&gt;'</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>All this code does is add the meta “description” tag to your WordPress pages and fills in the content depending on what kind of page it is. If it’s a post or a page the content will be the first 140 characters of the excerpt of the post or, if you set it, the &#8220;metadescription&#8221; custom field.</p>
<p>I shouldn’t need to mention that if your even the slightest bit interested in your sites SEO then including meta tags is a must, and this is an easy way to do it.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/dev7studios?a=VSl8h2W7Etc:Ed0bcA4kNS0:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/dev7studios?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=VSl8h2W7Etc:Ed0bcA4kNS0:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=VSl8h2W7Etc:Ed0bcA4kNS0:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=VSl8h2W7Etc:Ed0bcA4kNS0:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=VSl8h2W7Etc:Ed0bcA4kNS0:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=VSl8h2W7Etc:Ed0bcA4kNS0:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/dev7studios?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=VSl8h2W7Etc:Ed0bcA4kNS0:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=VSl8h2W7Etc:Ed0bcA4kNS0:gIN9vFwOqvQ" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://dev7studios.com/resource/ultimate-wordpress-description-meta-tag-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Form Producer</title>
		<link>http://dev7studios.com/portfolio/form-producer/</link>
		<comments>http://dev7studios.com/portfolio/form-producer/#comments</comments>
		<pubDate>Tue, 10 Aug 2010 09:43:36 +0000</pubDate>
		<dc:creator>gilbitron</dc:creator>
				<category><![CDATA[Portfolio]]></category>

		<guid isPermaLink="false">http://dev7studios.com/?p=208</guid>
		<description><![CDATA[The PHP AJAX Form Producer takes the pain out of making AJAX powered forms on your website. Just use simple PHP code and all the hard work is done for you.]]></description>
			<content:encoded><![CDATA[The PHP AJAX Form Producer takes the pain out of making AJAX powered forms on your website. Just use simple PHP code and all the hard work is done for you.<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/dev7studios?a=Pa0ZPYqKf6U:PRZkf2TBkC0:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/dev7studios?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=Pa0ZPYqKf6U:PRZkf2TBkC0:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=Pa0ZPYqKf6U:PRZkf2TBkC0:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=Pa0ZPYqKf6U:PRZkf2TBkC0:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=Pa0ZPYqKf6U:PRZkf2TBkC0:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=Pa0ZPYqKf6U:PRZkf2TBkC0:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/dev7studios?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=Pa0ZPYqKf6U:PRZkf2TBkC0:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=Pa0ZPYqKf6U:PRZkf2TBkC0:gIN9vFwOqvQ" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://dev7studios.com/portfolio/form-producer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP SimpleCache</title>
		<link>http://dev7studios.com/portfolio/php-simplecache/</link>
		<comments>http://dev7studios.com/portfolio/php-simplecache/#comments</comments>
		<pubDate>Tue, 10 Aug 2010 08:50:03 +0000</pubDate>
		<dc:creator>gilbitron</dc:creator>
				<category><![CDATA[Portfolio]]></category>

		<guid isPermaLink="false">http://dev7studios.com/?p=201</guid>
		<description><![CDATA[The PHP SimpleCache Class is an easy way to cache 3rd party API calls. See a tutorial <a href="http://blog.gilbertpellegrom.co.uk/post/592887883/php-simplecache-redux">here</a>.]]></description>
			<content:encoded><![CDATA[The PHP SimpleCache Class is an easy way to cache 3rd party API calls. See a tutorial <a href="http://blog.gilbertpellegrom.co.uk/post/592887883/php-simplecache-redux">here</a>.<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/dev7studios?a=6qzU65EC8ik:a-XI3Tw8glE:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/dev7studios?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=6qzU65EC8ik:a-XI3Tw8glE:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=6qzU65EC8ik:a-XI3Tw8glE:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=6qzU65EC8ik:a-XI3Tw8glE:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=6qzU65EC8ik:a-XI3Tw8glE:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=6qzU65EC8ik:a-XI3Tw8glE:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/dev7studios?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=6qzU65EC8ik:a-XI3Tw8glE:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=6qzU65EC8ik:a-XI3Tw8glE:gIN9vFwOqvQ" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://dev7studios.com/portfolio/php-simplecache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Thumbnails with the Nivo Slider</title>
		<link>http://dev7studios.com/resource/using-thumbnails-with-the-nivo-slider/</link>
		<comments>http://dev7studios.com/resource/using-thumbnails-with-the-nivo-slider/#comments</comments>
		<pubDate>Thu, 27 May 2010 13:02:14 +0000</pubDate>
		<dc:creator>gilbitron</dc:creator>
				<category><![CDATA[Resource]]></category>

		<guid isPermaLink="false">http://dev7studios.com/?p=186</guid>
		<description><![CDATA[In this tutorial I will show you how to set up and use thumbnails as the control navigation with the Nivo Slider. Search and Replace Thumbnails The default setting when using the controlNavThumbs setting in the Nivo Slider uses the controlNavThumbsSearch and controlNavThumbsReplace settings to generate the thumbnail url&#8217;s. Basically it takes the url for [...]]]></description>
			<content:encoded><![CDATA[<p>In this tutorial I will show you how to set up and use thumbnails as the control navigation with the <a href="http://nivo.dev7studios.com/">Nivo Slider</a>.</p>
<h3>Search and Replace Thumbnails</h3>
<p>The default setting when using the <code>controlNavThumbs</code> setting in the Nivo Slider uses the <code>controlNavThumbsSearch</code> and <code>controlNavThumbsReplace</code> settings to generate the thumbnail url&#8217;s. Basically it takes the url for each image, looks for whatever is defined in <code>controlNavThumbsSearch</code> (default &#8220;.jpg&#8221;) and replaces it with whatever is defined in <code>controlNavThumbsReplace</code> (default &#8220;_thumb.jpg&#8221;) and uses this new url for the thumbnail.</p>
<p>So for example if you have &#8220;images/slide1.jpg&#8221; as your image, the Nivo Slider script will generate the thumbnail url as &#8220;images/slide1_thumb.jpg&#8221;. This is the default functionality anyway and can be changed to your liking. So let&#8217;s see it in action. The HTML:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;slider&quot;</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;images/up.jpg&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;images/monstersinc.jpg&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;images/nemo.jpg&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;images/walle.jpg&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<p>Default HTML there. Nothing to worry about. Then we would use this setting in the Javascript:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#slider'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">nivoSlider</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
    controlNavThumbs<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">true</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Finally the most important bit. The CSS required to make the thumbnails is where most people trip up (by default the thumbnail images are hidden):</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#slider</span> <span style="color: #6666ff;">.nivo-controlNav</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span><span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">bottom</span><span style="color: #00AA00;">:</span><span style="color: #933;">-70px</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Put the nav below the slider */</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#slider</span> <span style="color: #6666ff;">.nivo-controlNav</span> img <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">inline</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Unhide the thumbnails */</span>
	<span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span><span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin-right</span><span style="color: #00AA00;">:</span><span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Note that these CSS styles will conflict with the &#8220;bullet&#8221; styles used in the &#8220;style-pack&#8221;. So only use one or the other, not both.</p>
<h3>Using the image &#8220;rel&#8221; Attribute</h3>
<p>The other option when using thumbnails with the Nivo Slider (v2.0+) is to use the <code>controlNavThumbsFromRel</code> setting. This simply generates the thumbnail url from the &#8220;rel&#8221; attribute in your images. So for exmaple:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;slider&quot;</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;images/up.jpg&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;images/up_thumb.jpg&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;images/monstersinc.jpg&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;images/monstersinc_thumb.jpg&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;images/nemo.jpg&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;images/nemo_thumb.jpg&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;images/walle.jpg&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;images/walle_thumb.jpg&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<p>Then in your Javascript you would do the following:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#slider'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">nivoSlider</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
    controlNavThumbs<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
    controlNavThumbsFromRel<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">true</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Now you can have even more control over your thumbnails. Note that the CSS above applies for both ways of using thumbnails.</p>
<h3>Conclusion</h3>
<p>So that&#8217;s how you use thumbnail control navigation in the <a href="http://nivo.dev7studios.com/">Nivo Slider</a>. If you need any more help then let me know in the comments.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/dev7studios?a=glopFl1tkeM:rIw7HoSiK_w:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/dev7studios?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=glopFl1tkeM:rIw7HoSiK_w:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=glopFl1tkeM:rIw7HoSiK_w:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=glopFl1tkeM:rIw7HoSiK_w:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=glopFl1tkeM:rIw7HoSiK_w:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=glopFl1tkeM:rIw7HoSiK_w:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/dev7studios?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=glopFl1tkeM:rIw7HoSiK_w:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=glopFl1tkeM:rIw7HoSiK_w:gIN9vFwOqvQ" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://dev7studios.com/resource/using-thumbnails-with-the-nivo-slider/feed/</wfw:commentRss>
		<slash:comments>52</slash:comments>
		</item>
		<item>
		<title>Nivo Zoom</title>
		<link>http://dev7studios.com/portfolio/nivo-zoom/</link>
		<comments>http://dev7studios.com/portfolio/nivo-zoom/#comments</comments>
		<pubDate>Thu, 22 Apr 2010 15:19:09 +0000</pubDate>
		<dc:creator>gilbitron</dc:creator>
				<category><![CDATA[Portfolio]]></category>

		<guid isPermaLink="false">http://dev7studios.com/?p=175</guid>
		<description><![CDATA[Nivo Zoom is a free jQuery Image Zoomer intended as a replacement to lightboxes.]]></description>
			<content:encoded><![CDATA[Nivo Zoom is a free jQuery Image Zoomer intended as a replacement to lightboxes.<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/dev7studios?a=d4zYrIlTHTA:6sQtve-t0nU:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/dev7studios?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=d4zYrIlTHTA:6sQtve-t0nU:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=d4zYrIlTHTA:6sQtve-t0nU:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=d4zYrIlTHTA:6sQtve-t0nU:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=d4zYrIlTHTA:6sQtve-t0nU:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=d4zYrIlTHTA:6sQtve-t0nU:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/dev7studios?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=d4zYrIlTHTA:6sQtve-t0nU:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=d4zYrIlTHTA:6sQtve-t0nU:gIN9vFwOqvQ" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://dev7studios.com/portfolio/nivo-zoom/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Will It Work</title>
		<link>http://dev7studios.com/portfolio/will-it-work/</link>
		<comments>http://dev7studios.com/portfolio/will-it-work/#comments</comments>
		<pubDate>Tue, 20 Apr 2010 18:46:51 +0000</pubDate>
		<dc:creator>gilbitron</dc:creator>
				<category><![CDATA[Portfolio]]></category>

		<guid isPermaLink="false">http://dev7studios.com/?p=172</guid>
		<description><![CDATA[Will it Work is a community of people who share their experiences so that others can benefit from their knowledge.]]></description>
			<content:encoded><![CDATA[Will it Work is a community of people who share their experiences so that others can benefit from their knowledge.<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/dev7studios?a=eBGWomUf97M:dQiT3CN1Kq8:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/dev7studios?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=eBGWomUf97M:dQiT3CN1Kq8:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=eBGWomUf97M:dQiT3CN1Kq8:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=eBGWomUf97M:dQiT3CN1Kq8:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=eBGWomUf97M:dQiT3CN1Kq8:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=eBGWomUf97M:dQiT3CN1Kq8:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/dev7studios?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=eBGWomUf97M:dQiT3CN1Kq8:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=eBGWomUf97M:dQiT3CN1Kq8:gIN9vFwOqvQ" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://dev7studios.com/portfolio/will-it-work/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Luxury Notes Theme</title>
		<link>http://dev7studios.com/portfolio/luxury-notes-wordpress-theme/</link>
		<comments>http://dev7studios.com/portfolio/luxury-notes-wordpress-theme/#comments</comments>
		<pubDate>Thu, 15 Apr 2010 17:22:17 +0000</pubDate>
		<dc:creator>gilbitron</dc:creator>
				<category><![CDATA[Portfolio]]></category>

		<guid isPermaLink="false">http://dev7studios.com/?p=169</guid>
		<description><![CDATA[Luxury Notes is a free Wordpress &#038; Tumblr theme that is designed to act as a personal online notepad.]]></description>
			<content:encoded><![CDATA[Luxury Notes is a free Wordpress &#038; Tumblr theme that is designed to act as a personal online notepad.<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/dev7studios?a=bAxE4l6LKRk:lw5P1P0PB5Y:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/dev7studios?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=bAxE4l6LKRk:lw5P1P0PB5Y:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=bAxE4l6LKRk:lw5P1P0PB5Y:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=bAxE4l6LKRk:lw5P1P0PB5Y:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=bAxE4l6LKRk:lw5P1P0PB5Y:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=bAxE4l6LKRk:lw5P1P0PB5Y:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/dev7studios?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=bAxE4l6LKRk:lw5P1P0PB5Y:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=bAxE4l6LKRk:lw5P1P0PB5Y:gIN9vFwOqvQ" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://dev7studios.com/portfolio/luxury-notes-wordpress-theme/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting Up the Nivo Slider in WordPress</title>
		<link>http://dev7studios.com/resource/setting-up-the-nivo-slider-in-wordpress/</link>
		<comments>http://dev7studios.com/resource/setting-up-the-nivo-slider-in-wordpress/#comments</comments>
		<pubDate>Fri, 09 Apr 2010 11:08:32 +0000</pubDate>
		<dc:creator>gilbitron</dc:creator>
				<category><![CDATA[Resource]]></category>

		<guid isPermaLink="false">http://dev7studios.com/?p=163</guid>
		<description><![CDATA[Setting up the Nivo Slider in WordPress is a fairly similar process to setting it up on a normal HTML page. However to do it properly there are a few small differences and methods you should use that are WordPress specific. Download and Setup First off download the Nivo Slider and put it in your [...]]]></description>
			<content:encoded><![CDATA[<p>Setting up the <a href="http://nivo.dev7studios.com/">Nivo Slider</a> in WordPress is a fairly similar process to setting it up on a normal HTML page. However to do it properly there are a few small differences and methods you should use that are WordPress specific.</p>
<h3>Download and Setup</h3>
<p>First off download the <a href="http://nivo.dev7studios.com/">Nivo Slider</a> and put it in your WordPress theme folder somewhere (for instance in &#8220;scripts/nivoslider&#8221;). You can put the CSS file in a separate folder if you wish but for simplicity I am just going to leave the contents of the download in the same folder. I&#8217;m also assuming here that you have your images in the &#8220;images&#8221; folder in your theme.</p>
<h3>The HTML</h3>
<p>Setting up the HTML for the slider is almost exactly the same as doing it in a normal HTML page. Something like the following:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;slider&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&lt;?php bloginfo(&quot;</span>template_url<span style="color: #ff0000;">&quot;); ?&gt;</span></span>/images/slide_1.jpg&quot; alt=&quot;&quot; /&gt;
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&lt;?php bloginfo(&quot;</span>template_url<span style="color: #ff0000;">&quot;); ?&gt;</span></span>/images/slide_2.jpg&quot; alt=&quot;&quot; /&gt;
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&lt;?php bloginfo(&quot;</span>template_url<span style="color: #ff0000;">&quot;); ?&gt;</span></span>/images/slide_3.jpg&quot; alt=&quot;&quot; title=&quot;This is an example of a caption&quot; /&gt;
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&lt;?php bloginfo(&quot;</span>template_url<span style="color: #ff0000;">&quot;); ?&gt;</span></span>/images/slide_4.jpg&quot; alt=&quot;&quot; /&gt;
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<p>Note that images can have links and captions come from the images &#8220;title&#8221; attribute. We use the WordPress <a href="http://codex.wordpress.org/Function_Reference/bloginfo">bloginfo()</a> function to make sure we have the proper path to our images.</p>
<h3>The PHP &#038; Javascript</h3>
<p>On to the fun part. Here is the code first for you &#8220;copy &#038; pasters&#8221;.</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- Include jQuery --&gt;</span>
<span style="color: #009900;">&lt;?php wp_enqueue_script<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'jquery'</span><span style="color: #66cc66;">&#41;</span>; ?&gt;</span>
<span style="color: #009900;">&lt;?php wp_head<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; ?&gt;</span>
<span style="color: #808080; font-style: italic;">&lt;!-- Include the Nivo Slider CSS file --&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">link</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;stylesheet&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&lt;?php bloginfo(&quot;</span>template_url<span style="color: #ff0000;">&quot;); ?&gt;</span></span>/scripts/nivoslider/nivo-slider.css&quot; type=&quot;text/css&quot; media=&quot;screen&quot; /&gt;
<span style="color: #808080; font-style: italic;">&lt;!-- Include the Nivo Slider JS file --&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&lt;?php bloginfo(&quot;</span>template_url<span style="color: #ff0000;">&quot;); ?&gt;</span></span>/scripts/nivoslider/jquery.nivo.slider.pack.js&quot; type=&quot;text/javascript&quot;&gt;<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #808080; font-style: italic;">&lt;!-- Set up the Nivo Slider --&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span>
jQuery(window).load(function() {
	jQuery('#slider').nivoSlider();
});
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span></pre></div></div>

<p>First off we are going to <a href="http://digwp.com/2009/06/including-jquery-in-wordpress-the-right-way/">include jQuery the right way</a> by using the WordPress <a href="http://codex.wordpress.org/Function_Reference/wp_enqueue_script">wp_enqueue_script()</a> function. Note that this has to be done before the wp_head() function.</p>
<p>Next we include the Nivo Slider CSS and JS files using the <a href="http://codex.wordpress.org/Function_Reference/bloginfo">bloginfo()</a> function to ensure the correct paths are used. Remember to alter the paths if the folder structure is different in your theme.</p>
<p>Finally we set up the jQuery script to load the Nivo Slider. Note that we need to use &#8220;jQuery&#8221; rather than just &#8220;$&#8221; as jQuery is in &#8220;no-conflict&#8221; mode. Now you should have a lovely slider on your WordPress site.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/dev7studios?a=QkVbLwBgKPI:T8PhZZMSVXU:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/dev7studios?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=QkVbLwBgKPI:T8PhZZMSVXU:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=QkVbLwBgKPI:T8PhZZMSVXU:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=QkVbLwBgKPI:T8PhZZMSVXU:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=QkVbLwBgKPI:T8PhZZMSVXU:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=QkVbLwBgKPI:T8PhZZMSVXU:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/dev7studios?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=QkVbLwBgKPI:T8PhZZMSVXU:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=QkVbLwBgKPI:T8PhZZMSVXU:gIN9vFwOqvQ" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://dev7studios.com/resource/setting-up-the-nivo-slider-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>90</slash:comments>
		</item>
		<item>
		<title>jQuery Nivo Slider</title>
		<link>http://dev7studios.com/portfolio/jquery-nivo-slider/</link>
		<comments>http://dev7studios.com/portfolio/jquery-nivo-slider/#comments</comments>
		<pubDate>Sat, 20 Mar 2010 13:36:26 +0000</pubDate>
		<dc:creator>gilbitron</dc:creator>
				<category><![CDATA[Portfolio]]></category>

		<guid isPermaLink="false">http://dev7studios.com/?p=154</guid>
		<description><![CDATA[Nivo Slider is the Most Awesome jQuery Image Slider out. And it's free.]]></description>
			<content:encoded><![CDATA[Nivo Slider is the Most Awesome jQuery Image Slider out. And it's free.<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/dev7studios?a=y_QZCeTXPhw:Dco5EBp1pIw:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/dev7studios?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=y_QZCeTXPhw:Dco5EBp1pIw:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=y_QZCeTXPhw:Dco5EBp1pIw:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=y_QZCeTXPhw:Dco5EBp1pIw:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=y_QZCeTXPhw:Dco5EBp1pIw:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=y_QZCeTXPhw:Dco5EBp1pIw:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/dev7studios?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=y_QZCeTXPhw:Dco5EBp1pIw:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=y_QZCeTXPhw:Dco5EBp1pIw:gIN9vFwOqvQ" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://dev7studios.com/portfolio/jquery-nivo-slider/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Elegant &amp; Maintainable AJAX in Web Apps</title>
		<link>http://dev7studios.com/resource/elegant-maintainable-ajax-in-web-apps/</link>
		<comments>http://dev7studios.com/resource/elegant-maintainable-ajax-in-web-apps/#comments</comments>
		<pubDate>Tue, 16 Mar 2010 22:58:54 +0000</pubDate>
		<dc:creator>gilbitron</dc:creator>
				<category><![CDATA[Resource]]></category>

		<guid isPermaLink="false">http://dev7studios.com/?p=146</guid>
		<description><![CDATA[When creating modern web apps you can end up spending a lot of your time dealing with &#8220;AJAXifying&#8221; forms. Thanks to popularisation of Javascript frameworks this has become far simpler than it used to be. However as web developers we need to be looking at ways of streamlining the process and creating maintainable, elegant and [...]]]></description>
			<content:encoded><![CDATA[<p>When creating modern web apps you can end up spending a lot of your time dealing with &#8220;AJAXifying&#8221; forms. Thanks to popularisation of Javascript frameworks this has become far simpler than it used to be. However as web developers we need to be looking at ways of streamlining the process and creating maintainable, elegant and reusable code. This article will explain how to use <a href="http://jquery.com/">jQuery</a> and PHP to make using AJAX in your web apps a far simpler affair.</p>
<h3>HTML Forms</h3>
<p>One of the main problems with &#8220;AJAXifying&#8221; a form is that it doesn&#8217;t degrade nicely. If a user has Javascript turned off, all of a sudden your form&#8217;s are unusable. So what we ideally want to do is have perfectly normal working HTML forms that submit things to a PHP script, then drop some Javascript on top so that only users with Javascript turned on will get the benefit without punishing the minority. For those who are technically educated we want the Javascript to be completely decoupled from the HTML and PHP.</p>
<p>So when creating our HMTL forms we just create a bog standard working form:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">form</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;some_form&quot;</span> <span style="color: #000066;">method</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;post&quot;</span> <span style="color: #000066;">action</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;process.php&quot;</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;data&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;data&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Submit&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">form</span>&gt;</span></pre></div></div>

<h3>The PHP</h3>
<p>The only downside to the process we are going to create here is that messaging has to be done in two different ways. This means the PHP has to account for both AJAX and non-AJAX requests and the different ways they pass data. Unfortunately at the moment there is no easy solution for this so we just have to work through it.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_X_REQUESTED_WITH'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #990000;">strtolower</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_X_REQUESTED_WITH'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">'xmlhttprequest'</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">//Do non AJAX processing here...</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">//Do AJAX processing here...</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The one thing we do want to do if we are processing an AJAX request is make the data format we return as easy to use as possible. So I recommend using JSON. Not only does jQuery have built in parsing ability for JSON but PHP also makes it very easy to format and return a JSON response.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$response</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$response</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'error'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$response</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'message'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Do some processing. If there is an error...</span>
<span style="color: #000088;">$response</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'message'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'This is an Error returned by the server'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//... else ...</span>
<span style="color: #000088;">$response</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'data'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$data</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$response</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'error'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">echo</span> <span style="color: #990000;">json_encode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$response</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Here we use a simple array with an &#8220;error&#8221; boolean value and a &#8220;message&#8221;. You can add any other data you want to the array (like the &#8220;data&#8221; we added above) and echo an output using PHP&#8217;s <a href="http://php.net/manual/en/function.json-encode.php">json_encode</a> function. It&#8217;s that simple. You&#8217;ll see why it&#8217;s worth doing this when we get into the Javascript below.</p>
<h3>The Javascript</h3>
<p>Remember what we are trying to do here is make the Javascript completely decoupled from the HTML and PHP. So what we are going to do is rig up all of the forms on the page to automatically be submitted using AJAX and fire off events for each form when something happens. This way we can simply hook into these form events to process what is happening.</p>
<p>Note that below we are using the <a href="http://jquery.malsup.com/form/">jQuery Form plugin</a> which provides us with the lovely ajaxSubmit function.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;form&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">submit</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	e.<span style="color: #660066;">preventDefault</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> form <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	form.<span style="color: #660066;">ajaxSubmit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
		dataType<span style="color: #339933;">:</span> <span style="color: #3366CC;">'json'</span><span style="color: #339933;">,</span>
		beforeSubmit<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #003366; font-weight: bold;">var</span> event <span style="color: #339933;">=</span> jQuery.<span style="color: #660066;">Event</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'form:beforeSubmit'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			form.<span style="color: #660066;">trigger</span><span style="color: #009900;">&#40;</span>event<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>event.<span style="color: #660066;">isPropagationStopped</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
				<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
		beforeSend<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			form.<span style="color: #660066;">trigger</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'form:beforeSend'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
		success<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>json<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			form.<span style="color: #660066;">trigger</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'form:success'</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span>json<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
		error<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>response<span style="color: #339933;">,</span> <span style="color: #000066;">status</span><span style="color: #339933;">,</span> error<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			form.<span style="color: #660066;">trigger</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'form:error'</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span>response<span style="color: #339933;">,</span> <span style="color: #000066;">status</span><span style="color: #339933;">,</span> error<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
		complete<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			form.<span style="color: #660066;">trigger</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'form:complete'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>As you can see this small piece of Javascript rigs up all the forms on the page to be submitted using AJAX and trigger certain events during the process. The beforeSubmit event is a bit more complex as we want to be able to cancel the AJAX request in the event of form validation failing. So this is the Javascript we just drop into the page. Totally decoupled.</p>
<p>&#8220;But what do we do with it?&#8221; I hear you asking. Well it means that now all you have to do is hook in to those events for each form if you want to do some something with it. For example:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#some_form'</span><span style="color: #009900;">&#41;</span>
	.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'form:beforeSubmit'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>event<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #006600; font-style: italic;">//Do your validation here...</span>
		<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>validated<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			event.<span style="color: #660066;">stopPropagation</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
	.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'form:beforeSend'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #006600; font-style: italic;">//Show a loading message...</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
	.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'form:success'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>event<span style="color: #339933;">,</span> response<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>response.<span style="color: #660066;">error</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;strong&gt;Error:&lt;/strong&gt; '</span> <span style="color: #339933;">+</span> response.<span style="color: #660066;">message</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #006600; font-style: italic;">//Update UI...</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
	.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'form:error'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>event<span style="color: #339933;">,</span> response<span style="color: #339933;">,</span> <span style="color: #000066;">status</span><span style="color: #339933;">,</span> error<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;strong&gt;Error:&lt;/strong&gt; An error occurred while trying to save'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
	.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'form:complete'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #006600; font-style: italic;">//Hide loading message...</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>How cool is that? As you can see this makes attaching and processing form submissions via AJAX far easier. You don&#8217;t even have to use all of the events, only use the ones you need.</p>
<p>Two things to note. We use the <em>event.stopPropagation()</em> function in the &#8220;:beforeSubmit&#8221; event if we need to cancel the request. Also in the &#8220;:success&#8221; event we can use response.error and response.message. This is because we formatted our response in JSON in the PHP above. Any data that you put the PHP <em>response</em> array can now be access in the Javascript using &#8220;response.{data}&#8221;.</p>
<h3>Conclusion</h3>
<p>I would encourage all serious web developers using AJAX in their web apps to consider using a streamlined approach like the one outlined here when &#8220;AJAXifying&#8221; their forms. Clean, maintainable, reusable and elegant.</p>
<p>Credit where credit is due, this article builds upon the <a href="http://orderedlist.com/our-writing/resources/development/jquery-evented-programming-primer/">jQuery Evented Programming Primer</a> article over at <a href="http://orderedlist.com/">orderedlist.com</a> and would not be here if it wasn&#8217;t for amazing guys like them helping us out by sharing their knowledge.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/dev7studios?a=RHDYGtwbBJA:Yx19qJCkDXU:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/dev7studios?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=RHDYGtwbBJA:Yx19qJCkDXU:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=RHDYGtwbBJA:Yx19qJCkDXU:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=RHDYGtwbBJA:Yx19qJCkDXU:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=RHDYGtwbBJA:Yx19qJCkDXU:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=RHDYGtwbBJA:Yx19qJCkDXU:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/dev7studios?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dev7studios?a=RHDYGtwbBJA:Yx19qJCkDXU:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/dev7studios?i=RHDYGtwbBJA:Yx19qJCkDXU:gIN9vFwOqvQ" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://dev7studios.com/resource/elegant-maintainable-ajax-in-web-apps/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
