Quantcast
Channel: erdfisch blog - panels
Viewing all articles
Browse latest Browse all 6

Duplicated headlines using panels and the Omega framework

$
0
0

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.


Viewing all articles
Browse latest Browse all 6

Latest Images

Pangarap Quotes

Pangarap Quotes

Vimeo 10.7.0 by Vimeo.com, Inc.

Vimeo 10.7.0 by Vimeo.com, Inc.

HANGAD

HANGAD

MAKAKAALAM

MAKAKAALAM

Doodle Jump 3.11.30 by Lima Sky LLC

Doodle Jump 3.11.30 by Lima Sky LLC

Doodle Jump 3.11.30 by Lima Sky LLC

Doodle Jump 3.11.30 by Lima Sky LLC

Trending Articles


Mandalas de flores para colorear


Love Quotes Tagalog


Girasoles para colorear


Dibujos para colorear de perros


Dromedario para colorear


Gwapo Quotes : Babaero Quotes


Tagalog God Quotes to inspire you


RE: Mutton Pies (mely)


Ang Nobela sa “From Darna to ZsaZsa Zaturnnah: Desire and Fantasy, Essays on...


Amarula African Gin


Long Distance Relationship Tagalog Love Quotes


Libros para colorear


Sapos para colorear


Renos para colorear


Pulga para colorear


mayabang Quotes, Torpe Quotes, tanga Quotes


Tagalog Love Quotes and Confession


Mga Tala sa “Unang Siglo ng Nobela sa Filipinas” (2009) ni Virgilio S. Almario


El Vibora (1971) by Francisco V. Coching and Federico C. Javinal


EASY COME, EASY GO





Latest Images

Pangarap Quotes

Pangarap Quotes

Vimeo 10.7.0 by Vimeo.com, Inc.

Vimeo 10.7.0 by Vimeo.com, Inc.

HANGAD

HANGAD

MAKAKAALAM

MAKAKAALAM

Doodle Jump 3.11.30 by Lima Sky LLC

Doodle Jump 3.11.30 by Lima Sky LLC

Doodle Jump 3.11.30 by Lima Sky LLC

Doodle Jump 3.11.30 by Lima Sky LLC