page.tpl.php includes a number of prebuilt variables instead of calling functions in the template (other than render()).

These variables make templates less scary for themers, who can move them around without worrying about breaking PHP and causing site errors. However, this is also a layer of abstraction that must be dealt with if you want to change the defaults.

You can change them two ways:

  1. Overriding the relevant preprocess or process function in your sub-theme.
  2. Override page.tpl.php and adding your logic directly there, similar to how core or many other themes work.

Front end developers generally tend to avoid adding templates if necessary so the option to use functions is attractive and easier to maintain - no need to wrangle many template overrides, instead keep all overrides in one set of functions.

Adativetheme supplied variables

Custom variables supplied by Adaptivetheme 7.x-3.x and used in the page template:

  • $site_logo: Themed logo - linked to front with alt attribute.
  • $site_name: Site name linked to the homepage.
  • $site_name_unlinked: Site name without any link.
  • $hide_site_name: toggle_name boolean, used to toggle the visibility is the site name.
  • $visibility: Holds the class .element-invisible or is empty. Used to hide the site name if turned off in toggle settings (same behavior as Bartik).
  • $primary_navigation: Themed Main menu. Uses theme_links() and h2 header.
  • $secondary_navigation: Themed Secondary/user menu. Uses theme_links() and h2 header.
  • $primary_local_tasks: Split local tasks - primary. Allows you to print the primary local tasks separately from the secondary tasks.
  • $secondary_local_tasks: Split local tasks - secondary. Allows you to print the secondary local tasks separately from the primary tasks.
  • $tag: Prints the wrapper element for the main content, either a section or div element.

The $classes variable

Adaptivetheme enables the use of the $classes variable in the page template. AT does this to avoid abusing the body $classes variable too much, and the general philosophy is to apply classes within the scope they are being used - this goes right through for blocks, regions, nodes, comments and so on. Drupal 7 core does a pretty good job of this, however many themes abuse the body classes when wanting to inject classes for page, block or node level elements - we try to avoid this. Its not the dry'est approach, but its very granular.


The sub-theme ships with a standard set of regions, you can view these in page.tpl.php and in the sub-themes info file.

  regions[sidebar_first]     = Sidebar first
  regions[sidebar_second]    = Sidebar second
  regions[content]           = Main Content
  regions[highlighted]       = Highlighted
  regions[content_aside]     = Aside
  regions[secondary_content] = Secondary
  regions[tertiary_content]  = Tertiary
  regions[footer]            = Footer
  regions[leaderboard]       = Leaderboard
  regions[header]            = Header
  regions[menu_bar]          = Menu Bar
  regions[help]              = Help
  regions[page_top]          = Page top
  regions[page_bottom]       = Page bottom

@see adaptivetheme_preprocess_page()
@see adaptivetheme_process_page()

Last updated 29th April, 2012 - 2:30pm