Panels 2: Adding a node to a panel page

Last modified: August 31, 2009 - 09:02

The recommended method for adding a node to a panel page is as follows:

  • Navigate to the Panel Pages List at admin/panels/panel-page.
  • Click 'Edit' at the end of the row of the page you wish to add the node to.
  • Go to the 'Context' tab.
  • Under the Contexts section on the right, select 'Node' and click Add.
  • Select the node you want.
  • Save the node selection configure screen.
  • The configuration pop up goes away. Save the page.
  • Then go to the Content tab. Click any add content button. You will notice there is a section you do not normally see named 'Node context'. Any of these panes will allow you to display a node or information about a node. Use the 'Node content' pane under the 'Node context' section to do a basic node view.

For advanced theming

  • In the 'Node content' add config dialog, there is an item called the 'panel_identifier', which you can use to get maximum control over the presentation of the data and be able to automatically use different panel-based templates depending upon what you enter in that field. In your _phptemplate_variables, you can use a piece of code like this:

<?php
 
// under case 'node', assuming the variables array is named $vars:
 
if (!empty($vars['node']->panel_identifier)) {
   
$vars['template_files'][] = 'node-panel-' . $vars['node']->panel_identifier;
  }
?>

Alternative method for adding a node to a panel page
If the power of the above method is not needed or not wanted, there is always the legacy nodes module. Panels legacy nodes does not have a normal administrative UI, such as panels pages or mini panels. With this module, users may add a node directly to a panel via the add content interface. They may then select this node using an auto-complete field. In general, this method of adding nodes to panes should be considered deprecated and is only retained to support updating sites that use this older method. Moving forward, it is recommended that the context system be used to embed nodes, as that is far more powerful and interesting.

helping newbie (and OG Pages) users

In the default installation of the latest OG Pages and Panels, there is no simple way (default configuration) to include a node in the layout. This is one of the first things people will want to do, and it's in the video, but you don't see Node Content as an option for a new item. (I actually raised this first as a Pages issue: http://drupal.org/node/250469.)

I think this page contains the key information needed to add a node, but it doesn't mean much to a person trying to figuring things out for the first time (and it looks hard -- being in a hurry, I just enabled the deprecated Alternative Method -- thanks very much for describing it). If you could add some words to explain things for newbie and Pages users (go to the 'Contexts' tab *where*? Content tab where? will these steps even work for Pages?), it would be a huge boon. (And you are welcome to delete this comment!)

For those looking for this info: Go to the Contexts tab by visiting admin/panels/panel-page, and clicking on Edit for the page (panel) you want to add a node to. This brings up a page on which contains the tabs Context and Content. Within the Content tab, you may also see multiple tabs for each of your content types; be sure you have selected the right one.

Cannot add a node to Panels 2 (drupal-6.6|views-6.x-2.1)

iceman77 - December 9, 2008 - 12:21

Thanks for the tut but it seems as though no matter what i try i do not see a node displayed in the pane of my panel page. I have followed your instructions and although i select a valid node using the context option it will not save it... so i am left there stumped!

I have tried creating various different panel types and every method i have read on drupal support comments doesn't work.

Please help.

I'm using: drupal-6.6 with panels-6.x-2.0-alpha2, views-6.x-2.1 and other modules:
- imce
- nodewords
- pathauto
- token
- tinymce
- advanced help

Thanks
Iceman

Switch to Drupal 5.14

rohitmude - January 7, 2009 - 11:48

Dear Friend iceman77 ,earlier I used Drupal 6.8. I had the same experience as yours. especially

"I have tried creating various different panel types and every method i have read on drupal support comments doesn't work."

Nothing worked for me as well.

Then I switched to drupal 5.14. Everything works like clockwork.

Workaround: Use a view

xurizaemon - February 6, 2009 - 00:54

If you just want to insert a node into a panel, then this workaround is ugly, but: You can use a view.

For our purposes, this *was* actually what we wanted, because we really wanted "insert the most recent page that's flagged as 'promoted to front page' as the main content of our front-page panel".

But for other purposes, this is a lot of extra work. Still, it works, and is also suggested at http://drupal.org/node/324220 where this bug is filed as an issue.

I believe this issue may be fixed in the -dev version of Panels2, but haven't confirmed this. If you can, try -dev and see if that fixes it (that should help the fix get into an official release sooner).

 
 

Drupal is a registered trademark of Dries Buytaert.