<?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>confabulus &#187; musings</title>
	<atom:link href="http://blog.confabulus.com/category/rails/musings/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.confabulus.com</link>
	<description>rails, coding, and the goings on at confabulus</description>
	<lastBuildDate>Fri, 19 Feb 2010 22:08:06 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>laying out sections using content_for</title>
		<link>http://blog.confabulus.com/2008/06/01/layout-partials-with-content_for/</link>
		<comments>http://blog.confabulus.com/2008/06/01/layout-partials-with-content_for/#comments</comments>
		<pubDate>Mon, 02 Jun 2008 02:17:28 +0000</pubDate>
		<dc:creator>gaffo</dc:creator>
				<category><![CDATA[musings]]></category>
		<category><![CDATA[content_for]]></category>
		<category><![CDATA[layouts]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://blog.confabulus.com/?p=4</guid>
		<description><![CDATA[For the new style changes for confabulus, I made use of the content_for capabilities in rails. The currently has two sections, main and sidebar. content_for makes implementing this quite easy. In your layout file (example application.html.erb under app/views/layouts), you use a  to place each of the sctions. Here I used  to include my [...]]]></description>
			<content:encoded><![CDATA[<p>For the new style changes for confabulus, I made use of the content_for capabilities in rails. The currently has two sections, main and sidebar. <code>content_for</code> makes implementing this quite easy. In your layout file (example application.html.erb under app/views/layouts), you use a <code><%= yield :sectionname %></code> to place each of the sctions. Here I used <code><%= yield :sidebar %></code> to include my sidebar section. <code>:sidebar</code> is just the name I chose for the section.</p>
<pre class="brush: ruby">
&lt;div class=&quot;right&quot; id=&quot;main_right&quot;&gt;
&lt;div id=&quot;sidebar&quot;&gt;
&lt;%= yield :sidebar%&gt;
&lt;/div&gt;
&lt;/div&gt;
</pre>
<p>Then in the view for the page, you need to define the content for each section, for sidebar I have:</p>
<pre class="brush: ruby">
&lt;% content_for :sidebar do %&gt;
&lt;h2&gt;Please Login&lt;/h2&gt;
&lt;div class=&quot;content&quot;&gt;
... full view code omitted ...
&lt;% end %&gt;
</pre>
<p>So my views are of the form of:</p>
<pre class="brush: ruby">
&lt;% content_for :sidebar do %&gt;
... sidebar content goes here ...
&lt;% end %&gt;
&lt;% content_for :main do %&gt;
... main content goes here ...
&lt;% end %&gt;</pre>
<p>You can do this for an arbitrary number of sections.<br />
One thing to note is that if you are converting and forget to put a content_for block around the code, your view will render empty.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.confabulus.com/2008/06/01/layout-partials-with-content_for/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
