You are here

README.txt in Context 6

Context layouts
---------------
Context layouts provides a formalized way for themes to declare and switch
between page templates using Context. It is a continuation of an old Drupal
themer's trick to switch to something besides the standard `page.tpl.php` file
for a variety of special-case pages like the site frontpage, login page, admin
section, etc.


Requirements
------------
In order to use context layouts, your site must meet a few conditions:

- Context and Context layouts modules are enabled (`admin/build/modules`).
- You are using a theme which provides and has declared multiple layouts. (See
  "Example themes" for themes you can try.)


Basic usage
-----------
Once you have layouts enabled, you can have a context trigger the usage of a
particular layout in either the admin interface (`admin/build/context`) or
inline context editor. Different layouts may have fewer or greater regions than
the default page template, so adjust your blocks accordingly.


Supporting context layouts in your theme
----------------------------------------
You can add layouts support to your theme by declaring additional layouts in
your theme's info file. Here is an example:

`example.info`

    name = "Example"
    description = "Example theme"
    core = "6.x"
    engine = "phptemplate"

    regions[left] = "Left sidebar"
    regions[right] = "Right sidebar"
    regions[content] = "Content"
    regions[footer] = "Footer"

    ; Layout: Default
    layouts[default][name] = "Default"
    layouts[default][description] = "Simple two column page."
    layouts[default][template] = "page"
    layouts[default][regions][] = "content"
    layouts[default][regions][] = "right"

    ; Layout: Columns
    layouts[columns][name] = "3 columns"
    layouts[columns][description] = "Three column page."
    layouts[columns][stylesheet] = "layout-columns.css"
    layouts[columns][template] = "layout-columns"
    layouts[columns][regions][] = "left"
    layouts[columns][regions][] = "content"
    layouts[columns][regions][] = "right"
    layouts[columns][regions][] = "footer"

Each layout is declared under `layouts` with the key as the identifier that will
be used by context for this layout. You may use any reasonable machine name for
each layout, but note that `default` is special -- it will be the default layout
for your theme if no other layout is specified.

The following keys can be declared for each layout:

- `name`: The human readable name for this layout, shown in the admin UI.
- `description`: A short description of your layout, same as above.
- `stylesheet`: A stylesheet to be included with the layout. Optional.
- `template`: The name of the template file for this layout, without the
  `.tpl.php` extension.
- `region`: An array of regions supported by this layout. Note that any of the
  regions listed here **must also be declared** in the standard theme `regions`
  array.


Example themes
--------------
- Cube, a subtheme included with [Rubik][1] provides a variety of layouts.
- [Ginkgo][2] the default theme included with Open Atrium.

[1]: http://github.com/developmentseed/rubik/downloads
[2]: http://github.com/developmentseed/ginkgo/downloads

File

context_layouts/README.txt
View source
  1. Context layouts
  2. ---------------
  3. Context layouts provides a formalized way for themes to declare and switch
  4. between page templates using Context. It is a continuation of an old Drupal
  5. themer's trick to switch to something besides the standard `page.tpl.php` file
  6. for a variety of special-case pages like the site frontpage, login page, admin
  7. section, etc.
  8. Requirements
  9. ------------
  10. In order to use context layouts, your site must meet a few conditions:
  11. - Context and Context layouts modules are enabled (`admin/build/modules`).
  12. - You are using a theme which provides and has declared multiple layouts. (See
  13. "Example themes" for themes you can try.)
  14. Basic usage
  15. -----------
  16. Once you have layouts enabled, you can have a context trigger the usage of a
  17. particular layout in either the admin interface (`admin/build/context`) or
  18. inline context editor. Different layouts may have fewer or greater regions than
  19. the default page template, so adjust your blocks accordingly.
  20. Supporting context layouts in your theme
  21. ----------------------------------------
  22. You can add layouts support to your theme by declaring additional layouts in
  23. your theme's info file. Here is an example:
  24. `example.info`
  25. name = "Example"
  26. description = "Example theme"
  27. core = "6.x"
  28. engine = "phptemplate"
  29. regions[left] = "Left sidebar"
  30. regions[right] = "Right sidebar"
  31. regions[content] = "Content"
  32. regions[footer] = "Footer"
  33. ; Layout: Default
  34. layouts[default][name] = "Default"
  35. layouts[default][description] = "Simple two column page."
  36. layouts[default][template] = "page"
  37. layouts[default][regions][] = "content"
  38. layouts[default][regions][] = "right"
  39. ; Layout: Columns
  40. layouts[columns][name] = "3 columns"
  41. layouts[columns][description] = "Three column page."
  42. layouts[columns][stylesheet] = "layout-columns.css"
  43. layouts[columns][template] = "layout-columns"
  44. layouts[columns][regions][] = "left"
  45. layouts[columns][regions][] = "content"
  46. layouts[columns][regions][] = "right"
  47. layouts[columns][regions][] = "footer"
  48. Each layout is declared under `layouts` with the key as the identifier that will
  49. be used by context for this layout. You may use any reasonable machine name for
  50. each layout, but note that `default` is special -- it will be the default layout
  51. for your theme if no other layout is specified.
  52. The following keys can be declared for each layout:
  53. - `name`: The human readable name for this layout, shown in the admin UI.
  54. - `description`: A short description of your layout, same as above.
  55. - `stylesheet`: A stylesheet to be included with the layout. Optional.
  56. - `template`: The name of the template file for this layout, without the
  57. `.tpl.php` extension.
  58. - `region`: An array of regions supported by this layout. Note that any of the
  59. regions listed here **must also be declared** in the standard theme `regions`
  60. array.
  61. Example themes
  62. --------------
  63. - Cube, a subtheme included with [Rubik][1] provides a variety of layouts.
  64. - [Ginkgo][2] the default theme included with Open Atrium.
  65. [1]: http://github.com/developmentseed/rubik/downloads
  66. [2]: http://github.com/developmentseed/ginkgo/downloads