<?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>Forever Heavy. Web Design and Development Greensboro NC</title>
	<atom:link href="http://foreverheavy.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://foreverheavy.com</link>
	<description>Design On Tap.</description>
	<lastBuildDate>Fri, 21 Jan 2011 21:17:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>Mind-melting Design Inspiration, Week One</title>
		<link>http://foreverheavy.com/mind-melting-design-inspiration-round-one/</link>
		<comments>http://foreverheavy.com/mind-melting-design-inspiration-round-one/#comments</comments>
		<pubDate>Thu, 20 Jan 2011 22:32:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Inspiration]]></category>

		<guid isPermaLink="false">http://foreverheavy.com/?p=291</guid>
		<description><![CDATA[Roundups are awesome. Without the word inspiration, design would be extremely dull. There would also be one less channel on digital cable. I&#8217;ve rounded up a nice selection of items that gave me a warm fuzzy feeling all over. I also think its important to point out the good and the bad in each piece, [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/share?url=http://foreverheavy.com/mind-melting-design-inspiration-round-one/&text=Mind-melting+Design+Inspiration%2C+Week+One&via=nicholascoates&related=nicholascoates" title="Post to Twitter"><img class="nothumb" src="http://foreverheavy.com/cms/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter-micro3.png" alt="Post to Twitter" /></a></p></div><p>Roundups are awesome. Without the word inspiration, design would be extremely dull. There would also be one less channel on digital cable. I&#8217;ve rounded up a nice selection of items that gave me a warm fuzzy feeling all over. I also think its important to point out the good and the bad in each piece, perhaps just to force myself into experiencing a sensation of superiority.</p>
<div class="blogborder"></div>
<p><img class="blog-image" src="http://foreverheavy.com/wp-content/themes/foreverheavy2/blog-images/insp-1-1.jpg" alt="site"></p>
<h2>Iron to Iron</h2>
<p>I&#8217;m not normally a fan of the one-page brochure style site, but for some reason it works here. Beautiful textures and a perfectly subtle blend of colors make this design really stand out, but I&#8217;d still love to see it flow through to multiple pages. The highlight: the beautiful jQuery fueled &#8220;Services&#8221; section. A great way to illustrate the process that doesn&#8217;t overwhelm the user with buzzwords and lengthy descriptions.</p>
<h3><a target="_blank" href="http://www.irontoiron.com">Visit this Site</a></h3>
<div class="blogborder"></div>
<p><img class="blog-image" src="http://foreverheavy.com/wp-content/themes/foreverheavy2/blog-images/insp-1-2.jpg" alt="site"></p>
<h2>Teixidó</h2>
<p>Great texture and contrast. The copy argues the actual effectiveness of a site&#8217;s content. Ironically, the site manages to present a great deal of copy in a very organized, effective way. The only real noticeable flaw is more of a pet peeve- a bit of glitchiness on the initial load before Typekit kicks in. Favorite aspect: the fluid layout that increases the image size without breaking the typography&#8217;s overall integrity.</p>
<h3><a target="_blank" href="http://teixido.co/">Visit this Site</a></h3>
<div class="blogborder"></div>
<p><img class="blog-image" src="http://foreverheavy.com/wp-content/themes/foreverheavy2/blog-images/insp-1-3.jpg" alt="site"></p>
<h2>Pointless Corp.</h2>
<p>I LOVE this site. The perfect blend of modern design with a vintage flair. I really don&#8217;t have anything to complain about. Great choice of color, illustration, and typography. The layered paper effect usually strikes me as a little played out, but it works here beautifully without making the content feel claustrophobic like contained designs normally do.</p>
<h3><a target="_blank" href="http://www.pointlesscorp.com/">Visit this Site</a></h3>
<div class="blogborder"></div>
<p><img class="blog-image" src="http://foreverheavy.com/wp-content/themes/foreverheavy2/blog-images/insp-1-4.jpg" alt="site"></p>
<h2>Momento</h2>
<p>I&#8217;m a sucker for a wood layout. I&#8217;m more of a sucker for it when the texture is effectively used as an element instead of just a nice background image. The inset wood sections really make the site pop. Especially the &#8220;Take a tour of Momento&#8221; section. I also appreciate the extra attention to the ribbon used as a title to make it a nice, organic element instead of a quick solution to designer&#8217;s block.</p>
<h3><a target="_blank" href="http://momentoapp.com/">Visit this Site</a></h3>
<div class="blogborder"></div>
<p><img class="blog-image" src="http://foreverheavy.com/wp-content/themes/foreverheavy2/blog-images/insp-1-5.jpg" alt="site"></p>
<h2>Ben the Bodyguard</h2>
<p>Ben the Bodyguard is a great example of the future of brochure sites. The awe inspiring scroll/stroll down the street does a great job at illustrating the app&#8217;s various features. I&#8217;m sure we have a long string of ripoffs to look forward to, but for now, this is a great case study for effective product marketing.</p>
<h3><a target="_blank" href="http://benthebodyguard.com/">Visit this Site</a></h3>
<div class="blogborder"></div>
<p><img class="blog-image" src="http://foreverheavy.com/wp-content/themes/foreverheavy2/blog-images/insp-1-6.jpg" alt="site"></p>
<h2>McKinney</h2>
<p>There might be a little bias here since I&#8217;m a former Durham local, but McKinney&#8217;s clean, bold designs have always been a great source of inspiration for effective corporate branding. I&#8217;m also a huge Bad Penny fan, and McKinney did an incredible job designing the packaging for Big Boss Brewery. The agency&#8217;s extensive history developing media gives them a great opportunity to utilize their huge image header, which really grabs the viewer&#8217;s attention.</p>
<h3><a target="_blank" href="http://mckinney.com/">Visit this Site</a></h3>
<div class="blogborder"></div>
<p><img class="blog-image" src="http://foreverheavy.com/wp-content/themes/foreverheavy2/blog-images/insp-1-7.jpg" alt="site"></p>
<h2>Elegant Seagulls</h2>
<p>I&#8217;m a big fan of quirky illustration, if you haven&#8217;t noticed. Elegant Seagull&#8217;s mashup of bold patterns, delicate type, and rough sketches reminiscent of a Basquiat piece really work for me. Also, a series of extensive DNA tests confirmed the site&#8217;s claim of high levels of beard strength.</p>
<h3><a target="_blank" href="http://www.elegantseagulls.com/">Visit this Site</a></h3>
<div class="blogborder"></div>
<p><img class="blog-image" src="http://foreverheavy.com/wp-content/themes/foreverheavy2/blog-images/insp-1-8.jpg" alt="site"></p>
<h2>You Know Who</h2>
<p>This site features a color combination I&#8217;m not usually a fan of, but it works surprisingly well. I love the use of vintage stock and big type, which makes the content very easy on the eyes. The only weak link for me is the logo (or perhaps just the way the logo is contained), which seems a bit out of place in an otherwise very strong layout.</p>
<h3><a target="_blank" href="http://youknowwhodesign.com/">Visit this Site</a></h3>
<div class="blogborder"></div>
<p><img class="blog-image" src="http://foreverheavy.com/wp-content/themes/foreverheavy2/blog-images/insp-1-9.jpg" alt="site"></p>
<h2>Ferocious Quarterly</h2>
<p>I like this website for reasons contradictory to those of most other websites. Some sections initially felt &#8220;broken&#8221; before I realized the layout was intentional, but the reason the site inspired me was its effective use of very neutral tones, a sweet banner menu, and the creative way of displaying the blog archive, an effect that would be hard to achieve without the beautiful art and photography each entry features.</p>
<h3><a target="_blank" href="http://fe.rocious.com/">Visit this Site</a></h3>
<div class="blogborder"></div>
<p><img class="blog-image" src="http://foreverheavy.com/wp-content/themes/foreverheavy2/blog-images/insp-1-10.jpg" alt="site"></p>
<h2>Lost World&#8217;s Fairs</h2>
<p>Besides a very nice footer, the initial landing page for Lost World&#8217;s Fairs might seem a little&#8230; uninspired. Anyone who takes the time to click through the three featured links will enjoy the great use of typography and imagery. The Atlantis section specifically pisses me off with its excellence, since I had the idea to incorporate a similar elevator effect in a previous website, but just assumed it couldn&#8217;t work. Boohoo, right?</p>
<h3><a target="_blank" href="http://lostworldsfairs.com/">Visit this Site</a></h3>
<div class="blogborder"></div>
<p><img class="blog-image" src="http://foreverheavy.com/wp-content/themes/foreverheavy2/blog-images/insp-1-11.jpg" alt="site"></p>
<h2>Galpin</h2>
<p>Galpin doesn&#8217;t need a whole lot of pretty pictures to make in impact. He seems to have quite a knack for speaking volumes with typography. The &#8220;process&#8221; flowchart is a beautiful break from the site&#8217;s common structure, and the seemingly unconventional color scheme fits in perfectly with the rest of the site. I wish the design would have been translated over to his Tumblr blog, though.</p>
<h3><a target="_blank" href="http://galp.in/">Visit this Site</a></h3>
<div class="blogborder"></div>
<p><img class="blog-image" src="http://foreverheavy.com/wp-content/themes/foreverheavy2/blog-images/insp-1-12.jpg" alt="site"></p>
<h2>Never End Design</h2>
<p>I&#8217;ll start by saying I love everything from the bottom of the header down. I would have liked the header more if the illustration and structure was a little more fluid with the rest of the site, although I love the little seeds floating around the layout. Ah, childhood nostalgia. I love the layout of the rest of the site, though. The portfolio page is especially striking, with each screenshot seemingly randomly stacking together around the case study. An excellent use of whitespace on every page.</p>
<h3><a target="_blank" href="http://www.neverendesign.com/">Visit this Site</a></h3>
]]></content:encoded>
			<wfw:commentRss>http://foreverheavy.com/mind-melting-design-inspiration-round-one/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>New Site for a New Year</title>
		<link>http://foreverheavy.com/three-months-later-and-a-new-site-but-why/</link>
		<comments>http://foreverheavy.com/three-months-later-and-a-new-site-but-why/#comments</comments>
		<pubDate>Sun, 09 Jan 2011 19:12:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ranting and Raving]]></category>

		<guid isPermaLink="false">http://foreverheavy.com/?p=279</guid>
		<description><![CDATA[Six months ago I released v1 of Forever Heavy. The flow of traffic and work coming in was enormous, to say the least, but those benefits were far outweighed by the sheer amount I learned putting together a new site. Working for free and for yourself can be a monumental pain in the ass. As [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/share?url=http://foreverheavy.com/three-months-later-and-a-new-site-but-why/&text=New+Site+for+a+New+Year&via=nicholascoates&related=nicholascoates" title="Post to Twitter"><img class="nothumb" src="http://foreverheavy.com/cms/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter-micro3.png" alt="Post to Twitter" /></a></p></div><p>Six months ago I released v1 of Forever Heavy. The flow of traffic and work coming in was enormous, to say the least, but those benefits were far outweighed by the sheer amount I learned putting together a new site. Working for free and for yourself can be a monumental pain in the ass. As the saying goes, you tend to be your biggest critic. On top of that, you&#8217;re steering yourself away from work that pays bills, feeds you, and keeps your fridge stocked with delicious beer and cake. </p>
<p>Every time I redesign my portfolio, I consider it a trip back to college (only this college is far more cost-effective. Imaginary college. Apply today.). Forcing myself to learn and apply new techniques not only improved the overall look and functionality of my website, but also added a few new techniques to my skill set. This translates to better work in less time, meaning I&#8217;m not only benefiting from the initial launch and buzz of my new site, but also further down the road with prospective clients.</p>
<p>I&#8217;ve been asked several times why I chose to redesign my site a mere 6 months after releasing Forever Heavy, and I think that probably about sums it up. With that said, I hope you enjoy the new site.</p>
]]></content:encoded>
			<wfw:commentRss>http://foreverheavy.com/three-months-later-and-a-new-site-but-why/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Fetching Posts by Category in WordPress with jQuery (the Easy Way)</title>
		<link>http://foreverheavy.com/sort-wordpress-posts-by-category-without-refreshing-using-jquery/</link>
		<comments>http://foreverheavy.com/sort-wordpress-posts-by-category-without-refreshing-using-jquery/#comments</comments>
		<pubDate>Thu, 24 Jun 2010 04:26:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://foreverheavy.com/?p=156</guid>
		<description><![CDATA[Using some simple jQuery and PHP, we'll create a recent posts widget that you can filter by category without an annoying page refresh. No need to create extra annoying Wordpress pages and templates! We'll also apply a little jQuery animation so your container height will glide smoothly into place.]]></description>
			<content:encoded><![CDATA[<div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/share?url=http://foreverheavy.com/sort-wordpress-posts-by-category-without-refreshing-using-jquery/&text=Fetching+Posts+by+Category+in+WordPress+with+jQuery+%28the+Easy+Way%29&via=nicholascoates&related=nicholascoates" title="Post to Twitter"><img class="nothumb" src="http://foreverheavy.com/cms/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter-micro3.png" alt="Post to Twitter" /></a></p></div><p>Using some simple jQuery and PHP, we&#8217;ll create a Recent Posts widget that you can filter by category without an annoying page refresh. No need to create extra WordPress pages and templates! We&#8217;ll also apply a little jQuery animation so your container height will glide smoothly into place.</p>
<h3>NOTE: For a loose example of this tutorial in action, check out the sorter on my <a href="http://foreverheavy.com/sorter-example/">legacy portfolio</a>.</h3>
<div class="blogborder"></div>
<h3>1. Create Your Template</h3>
<p>First, we need to create a file called querySort.php and place the following code inside of it:</p>
<pre class="brush: php; title: ;">
&lt;?php
	// load wordpress into template. dont touch me!
	$path = $_SERVER['DOCUMENT_ROOT'];
	define('WP_USE_THEMES', false);
	require($path .'/wp-load.php');
	// ah, wordpress is loaded. balance has been restored.
	query_posts($_GET[&quot;query&quot;]);
?&gt;

&lt;div id=&quot;queryContainer&quot;&gt;
	&lt;?php if(have_posts()) : ?&gt;&lt;?php while(have_posts()) : the_post(); ?&gt;
	&lt;!-- place your post template here. --&gt;
	&lt;?php endwhile; ?&gt;
	&lt;?php endif; ?&gt;
&lt;/div&gt;
</pre>
<p>This is your entire template for the widget&#8217;s output. By including wp-load.php, we&#8217;re able to avoid the annoying need to declare the file as a WordPress template, create an empty Page, and apply said template to it. The most important part of this file is this line:</p>
<pre class="brush: php; title: ;">
query_posts($_GET[&quot;query&quot;]);
</pre>
<p>Upon each load, query_post will grab our query from a variable that jQuery passes to it. This variable contains, by default, options for the number of posts and a default starting category.</p>
<p>Style the loop as necessary. As long as the div &#8220;queryContainer&#8221; and the loop are maintained, you may style the output any way you&#8217;d like.</p>
<div class="blogborder"></div>
<h3>2. Sprinkle in Some jQuery</h3>
<p>Create another file called querySort.js and place the following code inside of it:</p>
<pre class="brush: jscript; title: ;">
jQuery(document).ready(function($) {
	// replace these default settings with your own
	$.querySort = {
		path_to_template: 'http://www.YOURSITE.com/wp-content/themes/YOURTHEME/',
		number_of_posts: 5,
		default_category: ''
	}

	// do the initial load.
	$(&quot;#querySort&quot;).load($.querySort.path_to_template + 'querySort.php' + '?query=showposts%3D' + $.querySort.number_of_posts + '%26category_name%3D' + $.querySort.default_category);

	//functions for the sorter
	$(&quot;#queryMenu a&quot;).click(function(){
		var thecat = $(this).attr(&quot;id&quot;);
		if (thecat == 'reset') {
			var query = '?query=showposts%3D' + $.querySort.number_of_posts + '%26category_name%3D' + $.querySort.default_category;
		} else {
			var query = '?query=showposts%3D' + $.querySort.number_of_posts + '%26category_name%3D' + thecat;
		}
		$(&quot;#querySort&quot;).animate({opacity: 0}, function() {
			$(&quot;#querySort&quot;).load($.querySort.path_to_template + 'querySort.php' + query, function() {
				height = $(&quot;#queryContainer&quot;).height() + 'px';
				$(&quot;#querySort&quot;).animate({opacity: 1, height:height});
			});
		});
		return false;
	});
});
</pre>
<p>Let&#8217;s break this down to make it easier to understand. Here are the default options provided by querySort:</p>
<pre class="brush: jscript; title: ;">
	$.querySort = {
		path_to_template: 'http://www.YOURSITE.com/wp-content/themes/YOURTHEME/',
		number_of_posts: 5,
		default_category: ''
	}
</pre>
<p>You&#8217;ll need to add the absolute path to the template you&#8217;ll be using this with (dont forget the trailing forward slash). If you&#8217;ve installed WordPress in a subdirectory, make sure to update the url to reflect that. Number_of_posts controls precisely the number of visible posts at a time, and default_category is only really necessary if you wish to limit the visible posts to a specific category and its children.</p>
<pre class="brush: jscript; title: ;">
// do the initial load.
	$(&quot;#querySort&quot;).load($.querySort.path_to_template + 'querySort.php' + '?query=showposts%3D' + $.querySort.number_of_posts + '%26category_name%3D' + $.querySort.default_category);
</pre>
<p>This loads the default, unsorted query as soon as the DOM is ready. Using the .load() function, jQuery loads querySort.php, appending a variable called query, which is then accessed by the wordpress function query_posts(). The contents of the div #querySort are replaced with the results. (if you customize this script in any way to add more filters, be sure your query is urlencoded.)</p>
<pre class="brush: jscript; title: ;">
//functions for the sorter
	$(&quot;#queryMenu a&quot;).click(function(){
		var thecat = $(this).attr(&quot;id&quot;);
		if (thecat == 'reset') {
			var query = '?query=showposts%3D' + $.querySort.number_of_posts + '%26category_name%3D' + $.querySort.default_category;
		} else {
			var query = '?query=showposts%3D' + $.querySort.number_of_posts + '%26category_name%3D' + thecat;
		}
		$(&quot;#querySort&quot;).animate({opacity: 0}, function() {
			$(&quot;#querySort&quot;).load($.querySort.path_to_template + 'querySort.php' + query, function() {
				height = $(&quot;#queryContainer&quot;).height() + 'px';
				$(&quot;#querySort&quot;).animate({opacity: 1, height:height});
			});
		});
		return false;
	});
</pre>
<p>This is where the magic happens. This function accesses the div holding your sorting options, grabbing the ID of your link and replacing the query&#8217;s category name with its contents. Next, it fades out the #querySort div, loads the results of the new query, then fades them back in, fluidly adjusting the height of #querySort to match the new height of your content. This prevents ugly flickers or large gaps beneath the widget.</p>
<p>That&#8217;s all there is to it. One more step, and you should have a working widget!</p>
<div class="blogborder"></div>
<h3>3. Add the Widget to Your Theme</h3>
<p>Now, assuming you know where you&#8217;re going to place the widget, you have but to place the following markup in your theme and apply your desired CSS styles.</p>
<pre class="brush: xml; title: ;">
&lt;div id=&quot;queryMenu&quot;&gt;
	&lt;ul&gt;
		&lt;li&gt;&lt;a href=&quot;#&quot; id=&quot;categoryslug&quot;&gt;Category Name&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href=&quot;#&quot; id=&quot;reset&quot;&gt;All Posts&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;
&lt;/div&gt;

&lt;div id=&quot;querySort&quot;&gt;
	&lt;!-- leave me empty. --&gt;
&lt;/div&gt;
</pre>
<p>The #queryMenu div is very simple to set up. Each anchor you create must have to category&#8217;s slug as the id. This will be used by jQuery to execute the filter. IMPORTANT: To reset the sorter, create an anchor with &#8216;reset&#8217; as the id. If, for some unimaginable reason, you have a category called Reset, you may want to change this to something else in your jQuery.</p>
<div class="blogborder"></div>
<h3>4. Enqueue and enjoy.</h3>
<p>Upload your new files to your theme&#8217;s directory. Enqueue querySort.js and pat yourself on the back. You should now have a working jQuery sorter!</p>
]]></content:encoded>
			<wfw:commentRss>http://foreverheavy.com/sort-wordpress-posts-by-category-without-refreshing-using-jquery/feed/</wfw:commentRss>
		<slash:comments>55</slash:comments>
		</item>
		<item>
		<title>5 Quick and Dirty Drupal Tips</title>
		<link>http://foreverheavy.com/10-quick-and-dirty-drupal-tips/</link>
		<comments>http://foreverheavy.com/10-quick-and-dirty-drupal-tips/#comments</comments>
		<pubDate>Sun, 20 Jun 2010 21:55:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://foreverheavy.com/?p=22</guid>
		<description><![CDATA[Drupal is an incredibly rich platform for content management, but its not always a walk in the park for front-end developers who need a quick solution. At the risk of insulting hardcore Drupal developers everywhere, here are some quick tips and useful snippets to help save you hours of development time and assist in keeping the hair-pulling-out to a minimum (hopefully).]]></description>
			<content:encoded><![CDATA[<div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/share?url=http://foreverheavy.com/10-quick-and-dirty-drupal-tips/&text=5+Quick+and+Dirty+Drupal+Tips&via=nicholascoates&related=nicholascoates" title="Post to Twitter"><img class="nothumb" src="http://foreverheavy.com/cms/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter-micro3.png" alt="Post to Twitter" /></a></p></div><p>Drupal is an incredibly rich platform for content management, but its not always a walk in the park for front-end developers who need a quick solution. At the risk of insulting hardcore Drupal developers everywhere, here are some quick tips and useful snippets to help save you hours of development time and assist in keeping the hair-pulling-out to a minimum (hopefully).</p>
<p>1. <a href="#limitblocks">Limit Blocks of Code Based on Authentication Status and Role</a><br />
2. <a href="#placeblocks">Place Block Regions In Any Template File</a><br />
3. <a href="#printviews">Print Views Programmatically</a><br />
4. <a href="#createsandbar">Create a Homepage Views Sandbar</a><br />
5. <a href="#itemsperpage">Deploy a Views &#8220;Items Per Page&#8221; Filter</a></p>
<div class="blogborder"></div>
<h3 id="limitblocks">1. Limit Blocks of Code Based on Authentication Status and Role</h3>
<p>The following snippet can be used to provide alternate content for unauthenticated users and vice versa:</p>
<pre class="brush: php; title: ;">
&lt;?php
global $user;
if ($user-&gt;uid) {
&lt;!-- content for logged in user--&gt;
} else {
&lt;!-- content for unauthenticated user--&gt;
}
?&gt;
</pre>
<p>Restricting content by role is just as easy using the machine readable role name in the following snippet:</p>
<pre class="brush: php; title: ;">
&lt;?php
  global $user;
  if (in_array('YOUR_ROLE_HERE', array_values($user-&gt;roles))) {
&lt;!-- content for specific role--&gt;
  }
?&gt;
</pre>
<p>Be sure to include the call to &#8216;global $user;&#8217; when deploying these snippets, lest you be caught with your pants down.</p>
<div class="blogborder"></div>
<h3 id="placeblocks">2. Place Block Regions In Any Template File</h3>
<p>By default, block regions are not accessible by normal means in views or node templates. There are two ways to access a block region outside of page.tpl.php. After you declare a region in your .info file, place the following snippet where you&#8217;d like the block to display:</p>
<pre class="brush: php; title: ;">
&lt;?php
	print theme('blocks', 'YOUR_REGION');
?&gt;
</pre>
<p>The more acceptable way is to create a variable in your template.php,</p>
<pre class="brush: php; title: ;">
&lt;?php
function YOURTHEME_preprocess_views_view__index(&amp;$vars, $hook) {
	  $vars['YOUR_REGION'] = theme('blocks', 'YOUR_REGION');
}
?&gt;
</pre>
<p>then print the variable as you normally would in your template: </p>
<pre class="brush: php; title: ;">
&lt;?php
print $YOUR_REGION;
?&gt;
</pre>
<div class="blogborder"></div>
<h3 id="printviews">3. Print Views Programmatically</h3>
<p>The following snippet of code allows you to place a view right into your .tpl file. There are numerous pros and cons to this approach. Lucky for you, this is Quick and Dirty, so I&#8217;ll just give you the pros.</p>
<pre class="brush: php; title: ;">
&lt;?php
  $view_args = array();
  $display_id = 'default';
  $view = views_get_view('YOUR_VIEW_NAME');
       if (!empty($view)) {
        print $view-&gt;execute_display($display_id , $view_args);
  }
?&gt;
</pre>
<p>The greatest advantage to this is the ability to quickly and easily use variables of the current page as dynamic arguments. Views 2 may give you access to some wonderful filters, but you may want to refine a view based solely on the variables of the current node (a related posts view that pulls a set of nodes with similar taxonomy terms, for example). I&#8217;ve also found it quite useful when deploying tabbed jQuery widgets (a good example is the &#8220;Popular&#8221; sidebar widget I built on http://governingpeople.com/).</p>
<p>Adding an argument to the view is as easy as updating this line:</p>
<pre class="brush: php; title: ;">
 $view_args = array($place_variable_here);
</pre>
<p>It&#8217;s important to note that you must define your argument in the view for this to work correctly. Also, if you have multiple arguments and only want, say, the second argument to be programmatic, change the line to this:</p>
<pre class="brush: php; title: ;">
 $view_args[1] = $place_variable_here;
</pre>
<p>You can also alter the display id to choose between your different view displays:</p>
<pre class="brush: php; title: ;">
 $display_id = 'default';
</pre>
<p>I highly recommend NOT using a Page view. This WILL override the title of the entire page. Default has always worked fine for me.</p>
<div class="blogborder"></div>
<h3 id="createsandbar">4. Create a Homepage Views Sandbar</h3>
<p>This is a great way to break a view apart for </p>
<p><span class="basecolor">IMPORTANT:</span> This snippet is built for an Unformatted List view.</p>
<p>You&#8217;ll need to go ahead and create a template for you view named views-view-unformatted&#8211;YOURVIEWNAME.tpl.php (replacing with the correct machine readable of your view, respectively). If you already have one of these created using Views 2&#8242;s lovely &#8220;Theme Information&#8221; tab, you probably have a document that looks something like this:</p>
<pre class="brush: php; title: ;">
&lt;?php
// $Id: views-view-unformatted.tpl.php,v 1.6 2008/10/01 20:52:11 merlinofchaos Exp $
/**
 * @file views-view-unformatted.tpl.php
 * Default simple view template to display a list of rows.
 *
 * @ingroup views_templates
 */
?&gt;
&lt;?php if (!empty($title)): ?&gt;
  &lt;h3&gt;&lt;?php print $title; ?&gt;&lt;/h3&gt;
&lt;?php endif; ?&gt;
&lt;?php foreach ($rows as $id =&gt; $row): ?&gt;
  &lt;div class=&quot;&lt;?php print $classes[$id]; ?&gt;&quot;&gt;
    &lt;?php print $row; ?&gt;
  &lt;/div&gt;
&lt;?php endforeach; ?&gt;
</pre>
<p>Now, we&#8217;re going to take that lovely default template and gut it a bit. For the sake of simplicity, I&#8217;m removing everything that we dont need, including the title (you may choose to keep this and style the template any way you wish). </p>
<p>The first snippet of code accesses the view&#8217;s pager and creates two variables based on the Items Per Page. Right below this, we&#8217;ll make the split with a very simple for loop for each of the two sections:</p>
<pre class="brush: php; title: ;">
&lt;?php
$whole = $view-&gt;pager['items_per_page'];
$half = ceil($whole /2);

for( $i=0; $i&lt;$half; $i++ ) {
	print $rows[$i];
}
?&gt;

SANDBAR CONTENT GOES HERE

&lt;?php
for( $i=$half; $i&lt;$whole; $i++ ) {
	if ($rows[$i]) {
		print $rows[$i];
	}
}
?&gt;
</pre>
<p>It may not be pretty, but it works wonders.</p>
<div class="blogborder"></div>
<h3 id="itemsperpage">5. Deploy a Views &#8220;Items Per Page&#8221; Filter</h3>
<p>I&#8217;m still surprised this option isn&#8217;t built in. Maybe I&#8217;m missing something. I&#8217;ll show you the simplest way to execute a pager with a set of links, but you can use this simple approach to build a dropdown with multiple choices with relative ease.</p>
<p>Open up your views-view.tpl template for the specific view you&#8217;ll be working with. It&#8217;s important that the view you created has its &#8220;Items to Display&#8221; option set equal to the highest option you will provide. If you want to have a maximum choice of 48, set you view&#8217;s limit to 48. If one of your choices exceeds the maximum, it just won&#8217;t show them. You&#8217;ll be able to set a default setting in the template.</p>
<pre class="brush: php; title: ;">
&lt;?php
$itemcount = $_GET['itemcount'];
if ($itemcount = 0) {
	$view-&gt;set_items_per_page(12);
} else {
	$view-&gt;set_items_per_page($itemcount);
}
?&gt;
</pre>
<p>Place this snippet at the top of your views-view tpl an you&#8217;re already halfway there. Quite simply, attaching a variable to the end of the url (i.e. http://www.yoursite.com/yourview?itemcount=24) will set the new count before executing the view. If no variable is present, it is set to default to 12. Here is a sample of an &#8220;items per page&#8221; div you can place anywhere within your view:</p>
<pre class="brush: xml; title: ;">
&lt;h3&gt;Items per page:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;your-view-name?itemcount=6&quot;&gt;6&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;your-view-name?itemcount=12&quot;&gt;12&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;your-view-name?itemcount=24&quot;&gt;24&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</pre>
<p>Until Views ship with a better alternative, this is a quick and painless way to implement an items per page filter.</p>
]]></content:encoded>
			<wfw:commentRss>http://foreverheavy.com/10-quick-and-dirty-drupal-tips/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>
