Susan Javurek said the following on 08/06/2011 06:51 PM:
Hi,
My sidebars weren't showing so I added variables to my controller,
e.g. " @sidebar_text = subscriber_page.render_part(:sidebar)" and then
in my view code "<%= @sidebar_text %>". Is there a better way?
Yes.
Use CSS. Its cleaner and more elegant.
I have in my layout file
</head>
<body id="<r:slug />" style="width: 1024px">
.......
<div id="content">
<div class="container">
<div id="main" style="clear:left;">
<div class="left narrow" id="sidebar">
<r:content part="sidebar" inherit="true" />
</div>
<div class="right wide">
<r:content />
</div>
</div>
Or sometimes I have more detail
<div id="leftside"><div id="sidebar">
<r:content part="sidebar-high" inherit="true" />
<r:content part="sidebar" inherit="true" />
<r:content part="sidebar-low" inherit="true" />
<r:content part="announcement" inherit="true" />
</div></div>
And the CSS
#leftside {
clear:left; float:left; margin:0 0 5px; padding:0; width:180px;
}
I use #sidebar or both left and right types in different layouts so I can do
* Sidebar */
#sidebar p, #sidebar ul, #sidebar ol {margin:0 0 8px 8px; padding:0;}
#sidebar ul li, #sidebar ol li {
list-style:square; padding:0; margin:0 0 4px 12px;
}
#sidebar p.block {font-size:0.9em; line-height:1.4em; margin:5px auto
15px auto; padding:5px; color:#555;
border-top:1px solid #ddd; border-right:1px solid
#bbb; border-bottom:1px solid #bbb; border-left:1px solid #ddd;
}
There are many sites that discuss using CSS for sidebar panels
In general, its easier with CSS than anything else :-)
Once you've mastered CSS, and CSS is worth the learnign curve.
http://csscreator.com/node/30906
http://bluerobot.com/web/layouts/layout2.html