how to put arbitrary CCK fields into a panel
meeotch - April 1, 2008 - 04:22
| Project: | Panels |
| Version: | 5.x-2.0-beta2 |
| Component: | Panel pages |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
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.)

#1
subscribing cos I didn't know you could even do this...
#2
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?
#3
@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.
#4
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!!!
#5
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:
<?phpif (!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.
#6
Automatically closed -- issue fixed for two weeks with no activity.