Last updated January 22, 2014. Created by banghouse on March 8, 2013.
Edited by heliogabal, discipolo, Cellar Door, osopolar. Log in to edit this page.

Extensions: Layouts

  • Your theme can use multiple layouts, each of which which is kept in a subfolder of 'mytheme/layouts/'.
  • To get started with your own layout, you can copy the Omega layouts folder into your sub-theme but you'll need to rename the layouts to something different. The regions declared in your subtheme.info file must match those in your .layout.inc file. Please see Creating A Custom Layout for more information.
  • A layout is an alternative to the main 'mytheme/page.tpl.php' file.
  • The default layout for your theme can be selected on the theme settings page.
  • The active layout of a given page can be changed through custom code, a Context module reaction (see the Context Omega module) or through Panels. This is useful for loading different layouts on different sections of your website.
  • The two main elements of a layout are
    1. A .layout.inc file that describes the layout. The structure of a .layout.inc file is similar to the theme .info file (name, description, and declaration of stylesheets and JavaScript files).
    2. A page.tpl.php file that provides the HTML structure for the layout
  • Using a layout adds a new layer of complexity. Try to keep the structural CSS, scripts, templates... separate from the more global theming of the site's look and feel. Keep all layout-related files in the layout sub-folder and the design files one level up in the theme folder.

Yet Undefined/In-Progress:

  • Extensions: Libraries
  • Extensions: Development
  • Extensions: Compatibility

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.

Comments

The active layout of a given page can be changed through custom code, a Context module reaction (see the Context Omega module) or through Panels. This is useful for loading different layouts on different sections of your website.

Please, provide code snippet!

some code snippets to set the layout programmatically would be great.