Sorry if this is a noob question, but how does one go about putting an arbitrary CCK field into a panel? I've gotten a CCK *group* to work, and also a node in it's entirety... but I can't for the life of me figure out how to grab just one or two CCK fields and display them in a panel.

(The context is: building a user profile page with Advanced Profile. I'd like to pull the "City" and "Country" fields out of my "Location" CCK group, and display only those... and other similar tasks.)

Comments

niklp’s picture

subscribing cos I didn't know you could even do this...

nevets’s picture

What about making a list/table view that uses user id for that argument, returns only fields you want and is filtered by the approriate content type?

meeotch’s picture

@nevets - sounds like a possibility. Could be overkill / slow? I'm not sure. I'll probably test this in the meantime. Any idea how to pass the argument to the view from the panel page? I'm pretty new to this.

I know there's a programmatic way of doing this, with template files + mini panels + who knows what else... but digging through the Advanced Profile module, the method is convoluted enough that I'm lost. I was hoping a simple example existed somewhere.

keithmorr’s picture

I used CCK Blocks module to create blocks for all CCK fields and then they can be easily added to the panes.

There seems to be a problem with my newest installation of the Panels Module though. This worked perfectly until I updated the module, but now panels does not shows these items available to add to the pane!!!

merlinofchaos’s picture

Status: Active » Fixed

gordonh submitted a patch here: http://drupal.org/node/97375

The other way is to use the panel identifier to create arbitrary node.tpl.php files.

In your _phptemplate_variables() function of template.php in the 'node' section, you can put:

  if (!empty($vars['node']->panel_identifier)) {
    $vars['template_files'][] = 'node-panel-' . $vars['node']->panel_identifier;
  }

Once you have that in the right place and working, you can then put 'foo' in the panel identifier of the 'node content' pane, and it will use node-panel-foo.tpl.php automatically. You can then use that template to print out any single item from $node->content that you like. It's a bit of a pain, I realize, but it's what we've got right now.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.