Skip to content

Theming with One Region

schasoli edited this page Sep 21, 2014 · 4 revisions

You might be used to seeing themes with an excessive amount of template files. With Kalatheme we try to keep things simple. What this means in practical terms is you will have most of the static elements for your site like a header in your page.tpl.php file while everything else on your page will be governed with panels layouts... specifically those provided by Panopoly Theme.

This paradigm lets us use awesome tools like Page Manager and Panelizer to build complex and responsive layouts through the GUI instead of with a myriad of template files. This makes your theme more manageable and maintainable and allows site builders and clients to build hitherto unaccessible content pages and layouts.

Here are some general guidelines for the One Region paradigm

  1. Determine how much stuff you want panels to control. Do I want panels to control my header and footer? Do I only want panels to control my node layout?
  2. Replace template files for specific entity types (like a node type called "Article") with panels layouts using Panelizer
  3. Try to avoid adding more regions to your theme and using another theming paradigm like Display Suite or Context. That said there are some use cases where you may want to have additional regions.
  4. When crafting page.tpl.php remember that it now serves mostly as a wrapper for your panels layouts.

Where you might have had a content area with side bars and a footer you will now see something more like this.

 <!-- Page Main -->
 <div id="main-wrapper" class="clearfix"><div id="main" class="clearfix">
   <div id="top-content" class="column container">
     <a id="main-content"></a>
     <?php if (($no_panels || $always_show_page_title) && $title): ?>
       <h1 id="page-title" class="title">
         <?php print $title; ?>
       </h1>
     <?php endif; ?>
     <?php if ($messages): ?>
 <div id="messages">
 <?php print $messages; ?>
 </div>
 <?php endif; ?>
   <?php if ($tabs): ?>
     <div id="tabs">
       <?php print render($tabs); ?>
     </div>
   <?php endif; ?>
   <?php if ($action_links): ?>
     <div id="action-links">
       <?php print render($action_links); ?>
     </div>
   <?php endif; ?>
 </div> <!-- /.section, /#top-content -->
 <div id="content" class="column <?php $no_panels ? print 'container' : ''; ?>">
   <?php print render($page['content']); ?>
 </div> <!-- /.section, /#content -->
</div></div> <!-- /#main, /#main-wrapper -->

In fact, you could simply have a page.tpl.php file with
<?php print render($page['content']); ?>
and run your whole site on panels layouts only.

If your footer is going to be mostly fixed i would preprocess it as necessary and then hardcode it into your page.tpl.php

using bootstrap menu

If not using a fixed header in page.tpl.php you might want to place bootstrap style menus in a panel. For now template.php has to be changed for this. You can use this template.php for a start (it uses tabs with dropdowns) and change it to your needs.