CSS Layout integration

Does anyone have any good information or examples of using multiple css
layouts to setup, say, a two-column design and a three-column design.

So I could 'flip a switch' and have the design go from a two-column
layout to a three-column layout.

Ideally I'd like to set it up so that there can be separate directories
of these layouts (themes ?) .

Any info or pointers are greatly appreciated.

Thanks

Matt

http://www.glish.com/css/

this is a good article
http://www.stopdesign.com/log/2005/06/24/zoom-layout.html

Let me clarify. I am quite familiar with CSS, but what I'm need are
examples of doing things 'the Rails way'

for instance, do I need to have different 'layout' files, or do I need
my normal layout file, with a bunch of 'if(@columns == 2) then elseif
(@columns==3) end etc....

or is this something that I should implement in the controller code?

I'd like to have an 'admin' page,where an administrator of a site could
re-design a site himself by specifying 2 or 3 column layout. Sort of
like some of the "Do-it-yourself" online shopping carts that allow for a
templatized design to be made based on certain input parameters (like #
of columns, colors, font size, etc)

Sorry I wasn't clear in my first post. I hope my clarification will
draw out more response.

Thanks

Matt

Matt,

I think that both of your ideas could work. I would recommend taking
the route that requires less code. If your 2 layout schemes are mostly
the same, then use one layout with code checks to turn on/off features
as needed. If your 2 layouts are completely different then using 2
layout files is likely the easier choice.

Aaron

The way I do this is to scan the stylesheet directory for .css and put those
entries in a drop down where the value and name is the filename w/o the
extension

the user can then use the drop down from their edit user info

in your rhtml you want to skin

just put a variable in a stylesheet tag that refers to that user info and
youre done

The way I do this is to scan the stylesheet directory for .css and put those
entries in a drop down where the value and name is the filename w/o the
extension
the user can then use the drop down from their edit user info

OK. I understand this part. no problem selecting css files.

in your rhtml you want to skin

I'm not sure of you mean by this. I don't know what a skin is.

just put a variable in a stylesheet tag that refers to that user info and
youre done

This I don't understand. Is this what you mean by 'skin'?

This variable would be initialized in the controller code I presume....
I'm not sure of how you are handing this variable to a
stylesheet_link_tag, I don't see how to give it this extra argument.

Matt

Matt,

You don't need to pass an extra argument just put the stylesheet name
in a variable like this:

@stylesheet = "FancyStylesheet"
<%= stylesheet_link_tag @stylesheet %>

There are lots of ways to do this. You could setup an @stylesheet
variable in your controller using an application wide before_filter to
ensure its always available. Another possibility would be to store the
stylesheet in the user's session:

<%= stylesheet_link_tag (session[:stylesheet] || "default") %>

Actually, I just reread your entries above and realized you want a
site-wide setting, not user specific. In that case I would not use the
session.

If you are going to have a number of settings that control how the
interface works then you may want to wrap this functionality in a
model. That makes it easy to store the settings in the database and
update them with a web interface. You could pull the settings out with
a before_filter or just access them right from the view like this:

<%= stylesheet_link_tag SiteLayout.stylesheet %>

Where "SiteLayout" is the name of your model and "stylesheet" is a
method you have defined that returns the current stylesheet.

Aaron

I use this plugin: http://nested-layouts.rubyforge.org/

So I have a master "application.rhtml" wrapper layout and nested
"single_col" / "two_col" / "three_col" etc. layouts. Then in my view I
just write a few blocks like this:

<% content_for "left_column" do %>
<h1>Left column content</h1>
<% end %>

<% inside_layout 'two_col' do %>
<h1>Main content</h1>
<% end %>