Multiple custom layouts work slightly different

Last modified: July 11, 2009 - 05:27

To have multiple custom layouts is not as straight forward than just adding another custom layout's folder and files to the sites/all/theme/mytheme folder. Chances are you'll end up with the WSOD.

Follow the steps on the previous page to create one custom layout with some naming changes:

Give a more general name that will be used for the:

  • Folder
  • The name in the theme.info file.
  • In the name of the function in the inc file

For instance:
In folder customlayout you have:

  • customlayout1.inc
  • customlayout1.png
  • customlayout1.css
  • customlayout1.tpl.php

Where customlayout1 is of course the name of your layout. In the previous page this was onerowtwocols.

In the mytheme.info file you use:
plugins[panels][layouts] = customlayout

Your customlayout.inc file will look like this:

<?php
function mytheme_customlayout1_panels_layouts() {
 
$items['customlayout1'] = array(
   
'title' => t('Custom Layout 1'),
   
'icon' => 'customlayout1.png',
   
'theme' => 'customlayout1',
   
'css' => 'customlayout1.css',
   
'panels' => array(
     
'left' => t('Left side'),
     
'right' => t('Right side')
    ),
  );
 
  return
$items;
}
?>

Create the files for your next custom layout, buy you don't need to create another folder. Instead, put all files in the customlayout folder.

Add another customlayout.inc

<?php
function mytheme_customlayout2_panels_layouts() {
 
$items['customlayout2'] = array(
   
'title' => t('Custom Layout 2'),
   
'icon' => 'customlayout2.png',
   
'theme' => 'customlayout2',
   
'css' => 'customlayout2.css',
   
'panels' => array(
     
'left' => t('Left side'),
     
'right' => t('Right side')
    ),
  );
 
?>

So, now in folder customlayout you have:

  • customlayout1.inc
  • customlayout1.png
  • customlayout1.css
  • customlayout1.tpl.php
  • customlayout2.inc
  • customlayout2.png
  • customlayout2.css
  • customlayout2.tpl.php

WSOD

janamills - November 25, 2009 - 10:50

I had this working with no problems for the last two or three weeks then suddenly I got a WSOD on all custom layout panel pages. Now when I go into editor I can change the layout to one of the standard layouts and the content is all still there, but the custom layouts have disapeared from that selection page. I am so confused, all the files are still there, havent been deleted, I am using D6x and panels3. Anyone got any ideas?

multiple layouts lead to WSOD

etrangerequitra... - November 26, 2009 - 09:50

Same here, one custom style works fine, when you add a second one the WSOD shows itself...
Same D6x and panels3.

Did you upgrade Panels recently?

Max_Headroom - December 1, 2009 - 20:32

I wrote the above using Panels 3.0
I am still using Panels 3.0 on a few sites where this still works.
What version is your Panels?

Im using Panels 6.x-3.2 from

etrangerequitra... - December 3, 2009 - 12:27

Im using Panels 6.x-3.2 from october the 21st, on previous versions it did work

reset theme

janamills - December 14, 2009 - 11:56

sorry for the late reply. I am such an idiot, had this problem before what I had to do was reset the theme, then switch back to your custom theme. don't know why, this doesn't happen every time you add a custom theme.

Jana

 
 

Drupal is a registered trademark of Dries Buytaert.