Dev:Theme Areas

From Habari Project

Jump to: navigation, search

Areas are places in a theme's templates that are designated to render block content.

See also Blocks.


Designating Areas

To designate an area as open for block display, add the relevant contexts and areas to the theme's xml:

  <author>K2 Team</author>
  <description>A port of the popular design K2 and first Habari "theme"</description>
  <license url="">Apache Software License 2.0</license>
    <area name="sidebar">
      <description><![CDATA[The sidebar area]]></description>
    <area name="nav">
      <description><![CDATA[The navigation area]]></description>

Displaying an Area

To output an area, echo the area method on the theme object, and pass it the name of the area to render.

<?php echo $theme->area('sidebar'); ?>


Admins have the ability to change the blocks that are displayed (and the content fed to those blocks) in any area based on criteria they set, such as the slug of the post being displayed, whether the page is an archive, etc.

An interface will exist in the admin to configure these settings, and no specialized code is required to implement this feature.

Block Area Templates

Theme developers may provide additional templates that are specific to areas in the theme so that block content is output differently. A list of fallback templates is currently on the Blocks page.
A movie demonstrating how area contexts can be applied to filenames to allow for fallback templates.
Personal tools