Panel Layout im Theme definienieren
dereine — 22. September 2009 - 20:04
-
Layout plugin in der Theme Info hinzufügen:
plugins[panels][layouts] = layoutplugin
-
Dateien anlegen:
layoutplugin.css (Stylesheet des Layouts)
layoutplugin.inc (Definition des Layouts)
layoutplugin.png (Bild für den Adminbereich)
layoutplugin.tpl.php (Ausgabe des htmls)
-
function themename_layoutplugin_panels_layouts() implementieren:
<?php
/**
* Implementation of hook_panels_layouts().
*/
function erdfisch_ef_twocol_60_40_panels_layouts() {
$items['ef_twocol_60_40'] = array(
'title' => t('EF twocol 60_40'), // Name
'icon' => 'ef_twocol_60_40.png', // Preview
'theme' => 'ef_twocol_60_40', // Template
'css' => 'ef_twocol_60_40.css', // Stylesheet
// Regionen.
'panels' => array(
'left' => t('Left column'),
'right' => t('Right column'),
),
);return $items;
}?>
- Dateien befüllen:
Dieses Beispiel ist wie man sieht, knallhart kopiert :)
/* $Id: twocol.css,v 1.1.2.1 2008/12/16 21:27:58 merlinofchaos Exp $ */.panel-2col {
/* overflow: hidden; */
}.panel-2col .panel-col-first {
float: left;
width: 60%;
}
* html .panel-2col .panel-col-first {
width: 59.9%;
}.panel-2col .panel-col-first .inside {
margin: 0 .5em 1em 0;
}.panel-2col .panel-col-last {
float: left;
width: 40%;
}
* html .panel-2col .panel-col-last {
width: 39.9%;
}.panel-2col .panel-col-last .inside {
margin: 0 0 1em .5em;
}#panels-edit-display .panel-pane,
#panels-edit-display .helperclass {
margin: .5em;
}.panel-2col .panel-separator {
margin: 0 0 1em 0;
}Template:
<?php
// $Id: panels-twocol.tpl.php,v 1.1.2.1 2008/12/16 21:27:58 merlinofchaos Exp $
/**
* @file
* Template for a 2 column panel layout.
*
* This template provides a two column panel display layout, with
* each column roughly equal in width.
*
* Variables:
* - $id: An optional CSS id to use for the layout.
* - $content: An array of content, each item in the array is keyed to one
* panel of the layout. This layout supports the following sections:
* - $content['left']: Content in the left column.
* - $content['right']: Content in the right column.
*/
?>
<div class="panel-display panel-2col clear-block" <?php if (!empty($css_id)) { print "id=\"$css_id\""; } ?>>
<div class="panel-panel panel-col-first">
<div class="inside"><?php print $content['left']; ?></div>
</div><div class="panel-panel panel-col-last">
<div class="inside"><?php print $content['right']; ?></div>
</div>
</div> - Fertig.
| Anhang | Größe |
|---|---|
| blog_2.jpeg | 9.33 KB |
| ef_twocol_60_40.css | 635 Bytes |
| ef_twocol_60_40.inc | 403 Bytes |
| ef_twocol_60_40.png | 193 Bytes |
| ef-twocol-60-40.tpl_.php.txt | 927 Bytes |
| blog_3.jpeg | 8.65 KB |



Kommentar hinzufügen