On Jul 27, 2009, at 2:24 PM, Mamed Mamedov wrote:

Hi everybody!

Here how I have resolved my problem with changing page's layout on- the-fly:) I have created my own extension folder with my namespace-tags for unusual

 desc %{
   Works like design switcher.
 tag 'gsession:design' do |tag|
     design_type = request.session["gsession_design"]
     if design_type == nil
         design_type = GenieSessionExtension.defaults[:design]
         request.session["gsession_design"] = design_type
     if layout = Layout.find_by_name(tag.attr["#{design_type}"])
         tag.globals.page.layout = layout

I have created layout named "master-index" with only one line in it:
<r:gsession:design full="full-index" light="light-index" />

With 2 arguments, which describes layout names for 'full' and 'light'
version of my site. You can define 'gsession_*design*' session variable at
any time by hitting, for example:* /genie/set/design/light*
All my pages have selected 'master-index' layout.
That is all, while page is rendered my tag switches current layout to
'full-index' or 'light-index' named layouts.

Waiting for comments ... Thank you:)

Have you disabled caching to do this?

Mamed Mamedov

On Thu, Jul 16, 2009 at 6:16 PM, Sean Cribbs <seancri...@gmail.com> wrote:

If all of your pages have the same layout at any time, make sure all
descendant pages have their layout set to <inherit> and then your extension
could change the layout on the root page.
However, it would not be trivial to do this on a per-user basis. Have you considered something like a combination of Javascript and CSS that lets your
users switch layouts?


Mamed Mamedov wrote:

Hi everybody!

I have a little question: how can I change page's layout from within my
Problem is, that I have 2 different page layouts for my site: [
and light-version ].
I want to write a mini-extension to switch between designs of my site
hitting: /design/set/full and /design/set/light or /design/reset
And I'am saving current design variable in current user's session.

And now, just need to change current page's layout on the fly accordingly
session value.
Mamed Mamedov
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Reply via email to