<?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>Greg van Brug</title>
	<atom:link href="http://gregvanbrug.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://gregvanbrug.com</link>
	<description></description>
	<lastBuildDate>Wed, 03 Feb 2010 04:06:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>PDA for PDD</title>
		<link>http://gregvanbrug.com/blog/news/pda-for-pdd/</link>
		<comments>http://gregvanbrug.com/blog/news/pda-for-pdd/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 03:58:02 +0000</pubDate>
		<dc:creator>greg</dc:creator>
				<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://gregvanbrug.com/?p=218</guid>
		<description><![CDATA[A Thanks! for the overwhelming response to the launch of the Philly Design Directory.]]></description>
			<content:encoded><![CDATA[<p>Late this past Sunday night, I launched the <a href="http://phillydesigndirectory.com">Philadelphia Design Directory</a>, a personal project I had been working on for the past 4 months. The response has been huge and I’m pretty overwhelmed by the amount of people that have contacted me in the past two days to get listed or to show their support. I’m not usually one to brag so I thought I’d share some of the responses I’ve received about the site.</p>
<p><em>“Thanks again for doing this site — fantastic!”</em></p>
<p><em>“Just wanted to say thanks for creating such a great resource for the Philadelphia creative community!”</em></p>
<p><em>“Looking forward to the site expanding and growing even more!”</em></p>
<p><em>“Very cool. This may help me change my life!”</em></p>
<p><em>“It’s absolutely beautiful, and by far the best resource I’ve seen for connecting our community!”</em></p>
<p>In my portfolio, I describe this project as an experiment. What I mean by that is that I’m adopting an open source philosophy to the site by opening up the development process of the site. I will soon publish a public changelog so site users can see what is planned for the site, give feedback on the site, and how it has evolved. If you have any suggestions, do get in touch.</p>
<p>I’m really glad the site has already helped so many people and really hope it continues to help build our community. I couldn’t be more excited about this project.</p>
]]></content:encoded>
			<wfw:commentRss>http://gregvanbrug.com/blog/news/pda-for-pdd/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Cycle on the Fly</title>
		<link>http://gregvanbrug.com/blog/jquery/cycle-on-the-fly/</link>
		<comments>http://gregvanbrug.com/blog/jquery/cycle-on-the-fly/#comments</comments>
		<pubDate>Fri, 11 Dec 2009 19:07:18 +0000</pubDate>
		<dc:creator>greg</dc:creator>
				<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://gregvanbrug.com/?p=193</guid>
		<description><![CDATA[That's right. Create a single page template for cycle-able galleries using jQuery.]]></description>
			<content:encoded><![CDATA[<p><a href=http://malsup.com/jquery/cycle/>Cycle </a>has to be my favorite jQuery plug-in for slideshows/galleries. It’s lightweight, super easy to implement, and it’s highly customizable. The bummer is if you throw just one image at it, it breaks. Up until now I had been using two templates for galleries — one for single image pages and one for multiple image pages. Then it hit me why not use jQuery to check to see how many elements are in a DIV and then spit out navigation if necessary. Bingo! So easy I should have thought of that one sooner.</p>
<h3>So how-se work-se?</h3>
<p>First grab <a href="http://jquery.com">jQuery</a> and the <a href="http://malsup.com/jquery/cycle/">Cycle plug-in</a>.</p>
<p>Load ‘em up in the header as normal.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">&lt;script src='path_to/jquery.js' type='text/javascript' &gt;&lt;/script&gt;
&lt;script src=&quot;path_to/jquery.cycle.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;</pre></td></tr></table></div>

<h3>And now the fun part.</h3>
<p>Cycle has a built in trigger that can be used to target a DIV to cycle and additional triggers for DIV’s to be used as “buttons” for previous and next transitions. For multiple image only galleries, this is super easy place some images in the cycle DIV and add some Previous and Next DIV’s in your template. Then just tell Cycle which ones to use for which. But in our case we want to use a single template for single and multiple image galleries. So this won’t quite work — unless you think busted single image galleries or buttons that don’t work on a page is a good thing…</p>
<p>What we need to do is write some extra code that checks for the number of images on our page and then dynamically add our navigation. </p>
<h3>The Check</h3>
<p>jQuery has a built in core function called <code>.length</code>. Guess what it does? That’s right checks the number of elements in an object. All we need to do is create a variable to hold this number and then test it to see if it’s larger than 1. </p>
<p>Here we go.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">var img_no = $('#gallery . *').length;
&nbsp;
if( img_no &gt;= 2 ) {
     $('#img-nav').append(&quot;&lt;span id='prev'&gt;Previous Image&lt;\/span&gt; / &lt;span id='next'&gt;Next Image&lt;\/span&gt;&quot;);
}</pre></td></tr></table></div>

<p>Here, I’ve created a variable called <code>img_no</code> and its value is set to the total number of all elements (* =  all) within a DIV I’ve given the ID of <code>gallery</code>. I then take this number and first check to see if it is larger or equal to 2. If it is true, I then use another jQuery function called <code>append</code> to add a chunk of HTML to our page within an empty DIV called <code>img-nav</code> — one span with the ID of <code>previous</code> for our previous button and one span with the ID of <code>next</code> for our next button.</p>
<h3>Wiring it all up</h3>
<p>Now that we’ve got our check set in place all we’ve got left to do is tell cycle what to cycle and what to use as our buttons.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">$('#gallery').cycle({
    next:   '#next', 
    prev:   '#prev'
});</pre></td></tr></table></div>

<p>The first part <code>$('#gallery').cycle</code> tells our page to to use the <code>gallery</code> DIV as our cycle. Next, I use the built previous and next functions using <code>next:</code> and <code>previous:</code> and tell each of them to trigger their respective ID’s.</p>
<p>And viloa, single template gallery. That simple.</p>
]]></content:encoded>
			<wfw:commentRss>http://gregvanbrug.com/blog/jquery/cycle-on-the-fly/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WP Last Update</title>
		<link>http://gregvanbrug.com/blog/wordpress/wp-last-update/</link>
		<comments>http://gregvanbrug.com/blog/wordpress/wp-last-update/#comments</comments>
		<pubDate>Fri, 13 Nov 2009 19:53:54 +0000</pubDate>
		<dc:creator>greg</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://gregvanbrug.com/?p=5</guid>
		<description><![CDATA[Want to show the last time you WordPress site was last modified? I'll show you how in one line. Yep, in only one line.]]></description>
			<content:encoded><![CDATA[<p>Pretty recently, I had to add a “Site last updated” feature to the footer of a WordPress site. Now there’s a couple of plug-ins that will do this automatically for you but if all you really need is the date of the last update, all of these plug-ins are a little over the top. Believe it or not, everything you need is built right into WP in the <code>get_lastpostmodified()</code> function. And with a little more PHP we can take this value and format it any way we like.</p>
<h3>Let’s have a look…</h3>
<p>The WP function <code>get_lastpostmodified()</code> retrieves the last time a post was modified. But that’s it, it just retrieves the value. To get it to show up, just <code>echo</code> the function.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">&lt;?php echo get_lastpostdate(); ?&gt;</pre></td></tr></table></div>

<p>You now should have something like this:</p>
<p><code>2009-11-10 11:38:47</code></p>
<p>That’s the raw date format from the database, but with a little more PHP we can take this value and make it pretty. As you probably can guess, we’re going to use the PHP Date function.</p>
<h3>Here’s our code:</h3>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">&lt;?php echo date(&quot;F j, Y&quot;, strtotime(get_lastpostmodified())); ?&gt;</pre></td></tr></table></div>

<h3>Ok so what’s all that…</h3>
<p>We call the PHP Date function with <code>date</code> — pretty obvious, I know. Next we tell it what format we want — I’m using <code>F j, Y</code> but there’s a lot more ways you can output this — check <a href="http://php.net/manual/en/function.date.php">the function reference</a> to find the format you want. Our example will give us a format like this: November 13, 2009. The important parts of this are the alphabetic characters; commas, dashes, spaces are optional. </p>
<p>Next we use the WordPress function <code>get_lastpostmodified</code> as a value for <code>strtotime</code>. The <code>strtotime</code> takes then takes our value, expects be a US English timestamp and then tries to parse it to a UNIX timestamp. The UNIX timestamp then can be formatted with our <code>F j, Y</code> and the <code>date</code> function tells it how to be handled.</p>
<p>No clunky plug-ins to manage, just a single line that does it’s thing. Pretty simple right?</p>
]]></content:encoded>
			<wfw:commentRss>http://gregvanbrug.com/blog/wordpress/wp-last-update/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Hello world!</title>
		<link>http://gregvanbrug.com/blog/hello-world/</link>
		<comments>http://gregvanbrug.com/blog/hello-world/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 19:38:47 +0000</pubDate>
		<dc:creator>greg</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://gregvanbrug.com/?p=1</guid>
		<description><![CDATA[Hello there. This is the new home for Philadelphia based print/​web designer, word­press devel­oper, photog­ra­pher, and screen printer, Greg van Brug.
]]></description>
			<content:encoded><![CDATA[<p>Hello there. This is the new home for Philadelphia based print/​web designer, word­press devel­oper, photog­ra­pher, and screen printer, Greg van Brug.</p>
]]></content:encoded>
			<wfw:commentRss>http://gregvanbrug.com/blog/hello-world/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

