Module: Ramaze::Helper::Layout

### Home Classes Methods

### In Files

- lib/ramaze/helper/layout.rb

### Namespace

- MODULE Ramaze::Helper::Layout::SingletonMethods

### Methods

- ::included

### Files

- Gemfile
- Rakefile

### Class/Module Index

Quicksearch

- Ramaze
- Ramaze::App
- Ramaze::Bin
- Ramaze::Bin::Create
- Ramaze::Bin::Runner
- Ramaze::Cache
- Ramaze::Cache::LRU
- Ramaze::Cache::LocalMemCache
- Ramaze::Cache::MemCache
- Ramaze::Cache::Redis
- Ramaze::Cache::Sequel
- Ramaze::Controller
- Ramaze::CoreExtensions
- Ramaze::CoreExtensions::Object
- Ramaze::CoreExtensions::String
- Ramaze::Current
- Ramaze::DefaultController
- Ramaze::Files
- Ramaze::Gestalt
- Ramaze::Helper
- Ramaze::Helper::Auth
- Ramaze::Helper::Bench
- Ramaze::Helper::BlueForm
- Ramaze::Helper::BlueForm::Form
- Ramaze::Helper::CSRF
- Ramaze::Helper::Cache
- Ramaze::Helper::Cache::SingletonMethods
- Ramaze::Helper::Email
- Ramaze::Helper::Erector
- Ramaze::Helper::Flash
- Ramaze::Helper::Formatting
- Ramaze::Helper::Gestalt
- Ramaze::Helper::Gravatar
- Ramaze::Helper::Identity
- Ramaze::Helper::Layout
- Ramaze::Helper::Layout::SingletonMethods
- Ramaze::Helper::Link
- Ramaze::Helper::Localize
- Ramaze::Helper::Localize::Dictionary
- Ramaze::Helper::Localize::Parser
- Ramaze::Helper::Markaby
- Ramaze::Helper::Maruku
- Ramaze::Helper::Paginate
- Ramaze::Helper::Paginate::Paginator
- Ramaze::Helper::Paginate::Paginator::ArrayPager
- Ramaze::Helper::Paginate::Paginator::DataMapperPager
- Ramaze::Helper::Remarkably
- Ramaze::Helper::RequestAccessor
- Ramaze::Helper::SendFile
- Ramaze::Helper::SimpleCaptcha
- Ramaze::Helper::Stack
- Ramaze::Helper::Thread
- Ramaze::Helper::Upload
- Ramaze::Helper::Upload::ClassMethods
- Ramaze::Helper::Upload::UploadedFile
- Ramaze::Helper::UserHelper
- Ramaze::Helper::UserHelper::Wrapper
- Ramaze::Helper::XHTML
- Ramaze::LRUHash
- Ramaze::Logger
- Ramaze::Logger::Informer
- Ramaze::Logger::LogHub
- Ramaze::Logger::Logger
- Ramaze::Logger::RotatingInformer
- Ramaze::Logger::Syslog
- Ramaze::Logging
- Ramaze::Reloader
- Ramaze::Reloader::Hooks
- Ramaze::Reloader::WatchInotify
- Ramaze::Reloader::WatchStat
- Ramaze::Request
- Ramaze::Response
- Ramaze::SpecLogger
- Ramaze::View
- Ramaze::View::Erector
- Ramaze::View::Erubis
- Ramaze::View::Ezamar
- Ramaze::View::Gestalt
- Ramaze::View::Haml
- Ramaze::View::Liquid
- Ramaze::View::Liquid::Tag
- Ramaze::View::Lokar
- Ramaze::View::Mustache
- Ramaze::View::Mustache::RamazeContext
- Ramaze::View::Nagoro
- Ramaze::View::Remarkably
- Ramaze::View::Sass
- Ramaze::View::Slippers
- Ramaze::View::Tagz
- Ramaze::View::Tagz::Methods
- Ramaze::View::Tenjin
- Innate
- Innate::View
- Innate::View::Slim
- Nagoro
- Nagoro::Pipe
- Nagoro::Pipe::RenderPartial
- Bacon
- Bacon::PrettyOutput
- Erector
- Erector::Widget
- Rack
- Rack::RouteExceptions
- Tenjin
- Tenjin::Template
- BlankSlate
- Controller
- MainController
- Object

No matching classes.

# Ramaze::Helper::Layout

Provides wrapper methods for a higher-level approach than the core layout method. The layout() method that comes with Innate/Ramaze is fairly basic as it only allows you to specify a single layout to always use or a block giving you some extra flexibility. The latter however is still a bit of a pain when dealing with many custom layouts in a single controller. Meet the Layout helper. This helper provides a single method (since April 2011, it used to provide more) called "set_layout". This method allows you to specify a number of layouts and the methods for which these layouts should be used.

## Examples

The most basic example is simply setting a layout as you would do with the layout() method:

    set_layout 'default'

This of course is very boring, time to add some more spices to our code:

    set_layout 'default' => [:index]

Woah! What just happened? It's quite easy actually, we merely defined that the layout called "default" should be used for the index method only. Pretty sweet huh? It gets even better:

    set_layout 'default' => [:index, :edit], 'alternative' => [:add, :process]

A few things changed. First of all there are now two key/value groups. Each group defines a layout (the key) and a set of methods (the value) for which each layout should be used. In this case the layout "default" will be used for index() and edit() but the layout "alternative" will be used for add() and process().

Last but not least, multiple calls to set_layout will no longer override any existing settings unless you actually specify the same method with a different layout. This is possible because the set_layout method stores all these details in an instance variable called "_ramaze_layouts".

@author Yorick Peterse @author Michael Fellinger @author Pistos

### Public Class Methods

included(into) click to toggle source

Extends the class that included this module so that the methods that this helper provides can be called outside of instance of class methods.

@param [Object] into The class that included this module. @author Michael Fellinger @author Pistos

    # File lib/ramaze/helper/layout.rb, line 56
    def self.included(into)
      into.extend SingletonMethods
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.