Saturday, June 23, 2012

Tricks with Panels

22/6/2012

I'm using Panels 7.x-3.2 and Drupal 7.14.  In the process of trying to get the slideshow to work I came across a few issues with Panels that I need to remember for next time (if I have the sense to check the blog first before spending a day trying to find solutions - as I did today with slideshow).

1.  Panels is great.  You can set up a node, a page, a block (mini-panel) and have a tabular css layout to get what you want.  Don't panic, however when you try to modify this layout (that is the layout of the panel blocks, you suddenly get a major error.  To avoid this happening (assuming you want to make up your own set of panels instead of using the standard ones) you first need to set up a custom layout.

The advantage of this is that if you have a number of layouts and you want to change them all at once - you just have to change the one.  More importantly you should not get that pesky error that you get when you try to modify it on the fly.

2.  There's a problem when you want to have an empty panel (well I had this problem anyway).  I wanted my slide show in the middle of the page with areas for other content on either side.  Solution is to make a blank node and put it into the panel.  New problem - its the old 'node title' problem.  Something about Drupal is that they don't give you an easy way to hide your node title - you have to do it in the .tpl file.  The easiest solution is to just comment out the line that prints the title - you do it in the PANEL.tpl file if the (blanc node) is in a panel.  Remember to use the basic node and not the article otherwise you will have author info that you can't get rid of!!)

3.  You've set up a beautiful sliding show but damn me if the thing is left justified.  You guessed it  - there seems to be no easy way to centre (or is it center) anything in Drupal - you've got to go to the css file and add:


.slidecenter{
width: 500px;
margin-left: auto;
margin-right: auto;
}

then you go to the mini-panel that you've set up for the slider under panels and ..... oh dear there doesn't seem to be any way of editing it.    For some reason when you simply click on min-panels that option doesn't come up.  The simple solution is to click onto 'content' and voila you can edit again (took a while to get to that as well!).  Anyway, when you go to content, you click on the panel that has the slider in it and choose css.  Then you add the css class (in my case 'slidecenter' and the image should now centre.

4. Returning to panels (2 years later), I had to edit the panel format - this is actually for a newsletter that I am doing.  Its a long story, but this is the best way to render the content of the newsletter - there'll be a dedicated section of this blog on that soon.  When I tried to change the layout of the panel, I go a mysterious error from 'my site'. "you are not authorised to access this page'

First step was to check my admin to see that all the boxes are ticked - they are (well there were a few that weren't but they had nothing to do with panels).  Next step (of course) was google.  Eventually - lurking at the bottom of a response from the maker - was yes, there is a problem - but I never expected people to want to do things this way!  Basically the error comes up if you edit a panel layout directly from 'edit content'.  The solution turns out to be simple - go edit, go straight to 'panel content', go to layout editor.  If you go to 'panel layout' you'll probably get the error.

The maker of panels is clearly in no rush to sort this one out as its been around for 2 years!

Here's the link to the initial report : https://www.drupal.org/node/1798846



No comments:

Post a Comment