Jan 13 2012
Jan 13

As default, Omega uses the h1.title in region--content.tpl.php.
When using panels, the panel title is used in $title. But what will happen if you want to use your headline inside your panel-layout? A use case might be a project where you have both sidebars in some parts of the project and panels in another part "simulating" a sidebar, for instance with block-styled content in the left panel pane, while main content goes into the right one. Now you will have the headline "within" the main content area on a sidebar display, while it's above the main content area on a panel display. If classic blocks are situated in a sidebar and block-styled content in a sidebar-like panel pane, they will now have a different upper margin relatively to the site header and the headline might also "flip" over the blocks on the left hand side.

As this is difficult to explain only using words, we have a little scheme here:

Our goal is that the H1 title headline "optically" behaves the same in the panel context as if we would just have a normal sidebar. So how to do this?

First, we have to add the title to the panel template.
If you use one of Omegas default panel layouts, copy and paste the layout from Omega to yourtheme/panels/layouts/ and open the *.tpl file. Add the h1 to the position where you want ot to appear (normally the main content part).

<h1 class="title" id="page-title"><?php print $display->get_title(); ?></h1>

($display->get_title() will catch the title that is defined in the panel.)

For custom templates, just add this code snippet to the place you want the title to be displayed.

Now the title should be displayed at the correct position. Or, at least, one of two, as now it is probably displayed twice, since it's still in region--content.tpl.php
However, we can't just remove it from there, because it should still be displayed if we are on a non panel page.

To check if the page is displayed with panels, you can use this function.

function has_panel() {
if (panels_get_current_page_display()) {
return true;
return false;

Put this in your template.php

Copy and paste the region--content.tpl from omega to your themes template folder and add the has_panel condition to the title request.

This should look like this:

<?php if ($title): ?>

Transform it to:

<?php if ($title && !has_panel()): ?>

Now it should work! Don't forget to set the titles in Panels now.

Jan 05 2012
Jan 05

One major problem with using panels for all pages is
that many modules doesn't have built in integration
for panels. A solution to this problem is to write an
integration for the module to get the full control but
this sure needs some time. So Swentel wrote a
module which allows to take over any existing page, yes any!

To use it start on admin > structure > pages
and "add an existing page". Let's put the Panels configuration page into a panel, so input something into the search paths, see image.

Once you have done this go back to admin > structure > pages,
there you see "pm_existing_pages-{name you choosed above}"; enable it
and configure the panel.

One important pane you should know is under "existing page" -> "existing page":

That's all, see

AnhangGrösse 33.9 KB 15.19 KB 44.74 KB

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web